无法推送到远程GIT存储库 - “[...]似乎不是git存储库” [英] Unable to push to remote GIT repository -- "[...] does not appear to be a git repository"

查看:141
本文介绍了无法推送到远程GIT存储库 - “[...]似乎不是git存储库”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的服务器上使用以下在适当的文件夹(我的子域的根, git.mydomain.com )中设置了我的GIT存储库:

  mkdir foo.git 
cd foo.git
git init --bare --shared

这将使存储库可通过URL git.mydomain.com/foo.git



在我的客户端上,尝试使用以下命令将提交的文件推送到服务器:
mkdir foo

  cd foo 
git init
git remote add foo myUser@git.mydomain.com:foo.git
git add readme.txt
git commit -mfoo
git push foo master
..输入用户密码..

只有结果:

  fatal:'foo.git'does看起来不是git仓库
fatal:远程终端意外挂起

但是,遵循一套不同的指南,我似乎无法解决这个问题EM。任何建议,将不胜感激,请记住,我对GIT很绿。

git remote add foo myUser@git.mydomain.com:foo.git 假定目录foo.git位于 myUser 用户。使用绝对路径例如 git remote add foo myUser@git.mydomain.com:/home/gitrepos/foo.git



如果您'在共享服务器上,您可以通过执行以下命令来检查您的主路径:

  echo $ HOME 

在我的情况下,产生:


home / u / 01234 /


如果我已将我的存储库存储在我的主路径中的www / git / ,命令可能看起来像这样:

  git remote add origin myUser@mydomain.com:/ home / u / 01234 / www / git / foo.git 


I've set up my GIT repository on my server using the following in the appropriate folder (the root of my subdomain, git.mydomain.com):

mkdir foo.git
cd foo.git
git init --bare --shared

This would make the repository available by the URL git.mydomain.com/foo.git.

On my client, trying to push the commited files to the server using the following: mkdir foo

cd foo
git init
git remote add foo myUser@git.mydomain.com:foo.git
git add readme.txt
git commit -m "foo"
git push foo master
.. entering user password ..

Only results in:

fatal: 'foo.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

However, following a set of different guides, I seem to be unable to resolve this problem. Any suggestions would be highly appreciated, please bear in mind that I'm quite green to GIT.

解决方案

The line git remote add foo myUser@git.mydomain.com:foo.git assumes that the directory foo.git is in the home directory of the myUser user. You're much better off using an absolute path e.g. git remote add foo myUser@git.mydomain.com:/home/gitrepos/foo.git

If you're on a shared server, you can check your home path by executing:

echo $HOME

Which, in my case, yields:

home/u/01234/

If I've stored my repositories in the www/git/ folder in my home-path, the command might look something like this:

git remote add origin myUser@mydomain.com:/home/u/01234/www/git/foo.git

这篇关于无法推送到远程GIT存储库 - “[...]似乎不是git存储库”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆