git错误:";添加远程存储库:'/数据/www/examplesite';似乎不是git存储库;
我已经使用git的本地实例(通过SmartGit)好几年了(使用到远程服务器的安全FTP)。这个工作流程可以完成这项工作,但我想进入现代,将我的更新直接推送到远程服务器 首先,在遥控箱上:git错误:";添加远程存储库:'/数据/www/examplesite';似乎不是git存储库;,git,smartgit,Git,Smartgit,我已经使用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
[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/
接下来,我尝试让本地和远程回购进行对话:
然后在此处输入我的详细信息:
单击“添加”会产生以下错误:
添加远程存储库:“/data/www/buymystufs.com”似乎不可用
可能是git存储库无法从远程存储库读取。请
确保您拥有正确的访问权限和存储库
存在
我已确认我拥有远程目录的权限:
[acoder@remote www]# ll
total 0
drwxrwx---. 3 apache webdev 18 May 11 15:51 buymystuffs.com
(用户acoder是webdev组的成员)
我还尝试使用gitinit--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文档
我错过了什么步骤才能在本地工作,然后将提交推送到上面设置的远程回购 经过一番研究,答案是我无法让git做我想让它做的事情。/home和/data/www目录(和/var)都被标记为
noexec
,这排除了更新后的链接
我们无法删除noexec,所以我有点运气不佳。如果您有一个可行的解决方案,允许我在noexec
环境中执行此操作,请跟进
感谢SO用户的帮助对话。您应该进行
bare
repo,以便能够从中推/拉。使用git init
创建的git回购是工作回购;使用git init--bare
创建的存储库将创建一个作为“持有者”的存储库。您可以使用git ls remote
从命令行访问远程存储库吗?@muecas,删除并重新创建远程目录buymystufs.com,然后发布git init--bare
。返回“初始化的空Git存储库”。当我检查显示的同一目录的状态时:fatal:此操作必须在工作树中运行
Ok,裸repo仅用于存储存储库本身。然后,您应该添加一些钩子以将工作签出到工作目录。你想让我解释一下怎么做吗?我可以写一个答案。简而言之,您需要在文档根目录之外设置git repo。然后,在推送时,应将repo的内容签出到文档根目录(以便发布)。继续执行上述步骤,并成功添加远程repo。请添加您的评论作为答案,以便其他人更容易找到。