首页 > 解决方案 > git 错误:“添加远程存储库:'/data/www/examplesite' 似乎不是 git 存储库”

问题描述

几年来,我一直使用本地 git 实例(通过 SmartGit)(使用安全 FTP 连接到远程服务器)。该工作流程完成了这项工作,但我想进入现代时代并将我的更新直接推送到远程服务器。

首先,在遥控盒上:

[acoder@remote www]# mkdir buymystuffs.com
[acoder@remote www]# cd buymystuffs.com/
[acoder@remote buymystuffs.com]# git status
fatal: Not a git repository (or any parent up to mount point /data/www)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
[acoder@remote buymystuffs.com]# git init
Initialized empty Git repository in /data/www/buymystuffs.com/.git/
[acoder@remote buymystuffs.com]# git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)

现在在本地系统上,我使用

在此处输入图像描述

Smartgit 日志:

[master (root-commit) bd5a85f] initial commit
/storage/web/git/buymystuffs.com> git commit --allow-empty --file=/tmp/smartgit-2242088229372859523tmp/commit-95902291203419258.tmp
/storage/web/git/buymystuffs.com> git init
Initialized empty Git repository in /storage/web/git/buymystuffs.com/.git/

接下来我尝试让本地和远程 repos 说话:

在此处输入图像描述

然后在这里输入我的详细信息:

在此处输入图像描述

单击添加会产生以下错误:

添加远程存储库:“/data/www/buymystuffs.com”似乎不是 git 存储库无法从远程存储库读取。:请确保您具有正确的访问权限并且存储库存在。

我已确认我有权访问远程目录:

[acoder@remote www]# ll
total 0
drwxrwx---.  3 apache webdev  18 May 11 15:51 buymystuffs.com

(用户 acoder 是 webdev 组的成员)

我还尝试使用git init --bare. 这让我克服了上面的错误。当我更新一个新的本地文档时,我没有看到提交和推送的选项。我只能提交。我试过了,然后检查了远程树,发现了这个:

[acoder@remote buymystuffs.com]$ ll /data/www/buymystuffs.com
total 12
drwxrwxr-x. 2 acoder acoder   6 May 14 10:32 branches
-rw-rw-r--. 1 acoder acoder  66 May 14 10:32 config
-rw-rw-r--. 1 acoder acoder  73 May 14 10:32 description
-rw-rw-r--. 1 acoder acoder  23 May 14 10:32 HEAD
drwxrwxr-x. 2 acoder acoder 242 May 14 10:32 hooks
drwxrwxr-x. 2 acoder acoder  21 May 14 10:32 info
drwxrwxr-x. 4 acoder acoder  30 May 14 10:32 objects
drwxrwxr-x. 4 acoder acoder  31 May 14 10:32 refs

而不是我试图提交的 index.html 文档。

我缺少哪些步骤才能在本地工作然后将提交推送到上面设置的远程仓库?

标签: gitsmartgit

解决方案


After a bit of research, the answer is that I am unable to make git do what I want it to do. Both /home and the /data/www directories (and /var) are marked noexec which rules out a post-update hook to push & deploy.

We're unable to remove noexec, so I am kind of out of luck. If you have a workable solution that lets me do this in a noexec environment please follow up.

Thanks to SO user muecas for the helpful conversation.


推荐阅读