Git push origin master获取'origin'似乎不是一个git存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10898617/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git push origin master getting 'origin' doesn't appear to be a git repository
提问by jkp
What I have done:
我做了什么:
git init
git remote add master www.xyz.org/git/arkad
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
I have http access to the remote git.
我可以通过 http 访问远程 git。
How to fix this?
如何解决这个问题?
Thanks.
谢谢。
回答by jkp
You added a remote called "master", not "origin". In your case you would need to do:
您添加了一个名为“master”的遥控器,而不是“origin”。在您的情况下,您需要执行以下操作:
git push master master
You probably want to read the man page for git remote, and you might now want to rename your remote to origin
:
您可能想阅读git remote的手册页,现在您可能想将遥控器重命名为origin
:
git remote rename master origin
Additionally it appears you didn't specify a protocol to use to talk to the remote: it will probably be either ssh://
or git://
. Given the fact there are two problems with your remote config you might want to do the following to correct your configuration:
此外,您似乎没有指定用于与远程通信的协议:它可能是ssh://
或git://
。鉴于您的远程配置存在两个问题,您可能需要执行以下操作来更正您的配置:
git remote rm master
git remote add origin ssh://www.xyz.org/git/arkad
Note: this assumes that you need to talk to the server over the ssh protocol, as noted above it could also be that you need to use the git protocol instead.
注意:这假设您需要通过 ssh 协议与服务器通信,如上所述,也可能需要使用 git 协议。
More useful help can also be found herecourtesy of the awesome guys at github.com.
回答by Fatih Arslan
You have to push to correct remote server. Just look at here:
您必须推送到正确的远程服务器。看看这里:
git remote -v
For example my own personal repo gives me:
例如我自己的个人仓库给了我:
% git remote -v
origin [email protected]:farslan/farslan.github.com.git (fetch)
origin [email protected]:farslan/farslan.github.com.git (push)
Therefore I can use:
因此我可以使用:
git remote origin master