致命的:'origin'似乎不是一个git仓库 [英] fatal: 'origin' does not appear to be a git repository
问题描述
我在我的Github帐户上有一个 forked
。
然后在我的本地机器上克隆它。它运行良好。我创建了几个分支(在 master
分支下)。我做了几个提交,它工作得很好。
我不知道当我这样做时我是如何得到以下错误的: git push origin master
致命:'origin'似乎不是git存储库
致命:远程端意外挂起
如何在不影响Github上的存储库的情况下解决错误?
我使用 Ubuntu 12.10
我的的内容。在执行
cat $(git rev-parse --show-toplevel)/ .git / config
后给出:
$ b
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefrefddates = true
[branchmaster]
[branchMOODLE_23_STABLE]
[branchMOODLE_24_STABLE]
[remoteupstream]
url = git:// git.moodle.org/moodle.git
fetch = + refs / heads / *:refs / remotes / upstream / *
$ H OME / .gitconfig
是您的全局 config for git。
配置文件的三个级别。
cat $(git rev-parse --show-toplevel)/ .git / config
pre>
( bereal )是你的 local config,您已克隆的回购本地。
您也可以在回购中输入:
git remote -v
然后看看是否有任何远程命名'$'
$ b如果不存在,如果该远程(缺省情况下在克隆repo时创建)缺失,则可以再次添加它:
p>
git re mote add origin url / to / your / fork
OP提到:
$ b
执行
git remote -v
给出:
上游git://git.moodle.org/moodle.git(fetch)
上游git://git.moodle.org/moodle.git(push)
所以'
origin
'丢失:对您的分支的引用。
请参阅 github中origin
和上游
之间的区别
I've a repository
moodle
on my Github account which Iforked
from the official repository.I then cloned it on my local machine. It worked fine. I created several branches (under the
master
branch). I made several commits and it worked fine.I don't know how I'm getting the following error when I do :
git push origin master
fatal: 'origin' does not appear to be a git repository fatal: The remote end hung up unexpectedly
How do I resolve the error without effecting my repository on Github?
I'm using
Ubuntu 12.10
The contents of my
.git/config
after doingcat $(git rev-parse --show-toplevel)/.git/config
gives:[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [branch "master"] [branch "MOODLE_23_STABLE"] [branch "MOODLE_24_STABLE"] [remote "upstream"] url = git://git.moodle.org/moodle.git fetch = +refs/heads/*:refs/remotes/upstream/*
解决方案
$HOME/.gitconfig
is your global config for git.
There are three levels of config files.cat $(git rev-parse --show-toplevel)/.git/config
(mentioned by bereal) is your local config, local to the repo you have cloned.
you can also type from within your repo:
git remote -v
And see if there is any remote named 'origin' listed in it.
If not, if that remote (which is created by default when cloning a repo) is missing, you can add it again:
git remote add origin url/to/your/fork
The OP mentions:
Doing
git remote -v
gives:
upstream git://git.moodle.org/moodle.git (fetch) upstream git://git.moodle.org/moodle.git (push)
So '
origin
' is missing: the reference to your fork.
See "What is the difference betweenorigin
andupstream
in github"这篇关于致命的:'origin'似乎不是一个git仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!