Git推送错误:“origin似乎不是git存储库”
我正在关注instructions given here以创建Git存储库。一切都很顺利,直到最后一行:Git推送错误:“origin似乎不是git存储库”
$ git push -u origin master
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
我使用Git版本1.7.11.3在OS X 10.6.8
$ git remote -v
返回任何内容的
配置文件repository:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
我h广告使用sudo visudo命令,打开sudoers文件,并添加以下代码行(在#用户特权规范):
git ALL=(ALL) ALL.
现在,如果我做的:
$ git remote add origin /Volumes/500GB/git-repository/myproject.git
它回来,并没有错误,但我没有看到任何代码库 (其具有上述目录,如树枝,钩,...)
如果我做的:
$ git push -u origin master
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
$ git remote -v
origin /Volumes/500GB/git-repository/myproject.git (fetch)
origin /Volumes/500GB/git-repository/myproject.git (push)
由于已经在che's answer中提到了有关添加远程部分的信息,我相信您仍然错过了这一部分。
关于您在本地USB驱动器上添加远程的编辑。首先,如果您希望您的存储库成为共享存储库,即可以推/拉/取/合并等,则必须拥有“裸存储库”。
要创建裸存/共享存储库,请转至你想要的位置。你的情况:
$ cd /Volumes/500gb/
$ git init --bare myproject.git
更多信息,请参见here创建纯仓库
一旦你有一个纯仓库中所需的位置设置了现在就可以作为一个远程添加到您的工作副本。
$ git remote add origin /Volumes/500gb/myproject.git
现在你可以把你的资料库修改
$ git push origin master
您的配置文件不包含任何对“origin”remote的引用。这部分看起来是这样的:
[remote "origin"]
url = [email protected]:repository.git
fetch = +refs/heads/*:refs/remotes/origin/*
您需要在远程添加使用git remote add
,然后才能使用它。
好吧,所以我需要做的git远程添加(见上) – 2013-03-15 19:04:03
在git中,你推,因为你想要让你的代码与你正在工作的其他代码不同。如果你想要做的就是拥有一个本地的git仓库,那么你已经完成了。如果你想要一些东西,你可能想看看一些教程,解释远程和本地回购,可能从这里开始:http://git-scm.com/book/en/Getting-Started-Git-Basics – che 2013-03-15 19:13:11
我想有2份代码。一个在mac(工作目录)的硬盘上,另一个在外部USB驱动器(Git目录)上。如果我有两个代码步骤(即原始文章中的最后一个步骤),那么我就完成了。但是在外部USB驱动器上没有看到任何源代码。我看到一个目录结构,包含分支,钩子,信息,对象,引用等目录,但没有源代码。 – 2013-03-15 19:46:25
下面是说明从GitHub:
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/tqisjim/google-oauth.git
git push -u origin master
下面是实际工作:
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/tqisjim/google-oauth.git
git clone origin master
克隆后,然后推命令成功通过提示用户名和密码
可能你忘了在远程运行“git --bare init
”? 这是我的问题
当你在bitbucket.org创建存储库,它提供了关于如何设置你的本地目录的说明。机会是,你只是忘了运行代码:
git remote add origin https://[email protected]/username/reponame.git
我的情况有点不同 - git仓库(在我的情况project.git目录)无意中我已经改变了主人,主人改变返回到git用户帮助
很有可能是远程存储库不存在或者您添加了错误的存储库。
你必须先删除原点,重新添加它:
git remote remove origin
git remote add origin https://github.com/username/repository
我有这个问题,因为我已经有了起源远程本地定义。 所以只是改变 “起源” 到另一个名字:
git的远程添加originNewhttps://github.com/UAwebM ...
混帐推-u originNew
或U可以删除你的本地出身。 检查您的远程名称类型:
远程Git
远程删除 - 登录您的克隆库和类型:
git的远程删除起源(取决于你的远程的名字)
如果你是在做HTTPS这 -
git remote add origin URL_TO_YOUR_REPO
为了解决这个问题,我只是创建一个新的文件夹,并把一些新的文件。然后使用这些commond。
* git add .
* git commit
* git remote add master `your address`
然后它告诉我登录后。 输入你的用户名和密码。 之后
git pull
git push origin master
完成你推你的代码,你的github上
很常见犯错。看看这个线程的帮助:http://*.com/questions/10068172/git-push-origin-master-does-not-work – tymeJV 2013-03-15 16:44:00
命令“git remote -v”的输出是什么? – brimble2010 2013-03-15 16:46:35
您的说明链接已删除,您是否记得它是什么? – 2014-06-27 13:26:58