Git推送错误:“来源似乎不是git存储库” [英] Git push error: "origin does not appear to be a git repository"
问题描述
$ git push -u原点大师
致命:'origin'似乎不是git存储库
致命:远程端
我在OS X 10.6.8上使用git version 1.7.11.3
$ git remote -v
退货没有
存储库的配置文件:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
我不得不使用sudo visudo命令打开sudoers文件并添加以下内容(在#用户特权规范下):
git ALL =(ALL)ALL。
现在如果我这样做:
$ git remote add origin /Volumes/500GB/git-repository/myproject.git
返回时没有错误,但我在代码库
中没有看到任何代码(它具有上述目录,如分支,钩子等)。
如果我这样做:
$ git push -u origin master
致命:'origin'似乎不是一个混帐存储库
fatal:远程端意外挂起
$ git remote -v
origin /Volumes/500GB/git-repository/myproject.git (fetch)
origin /Volumes/500GB/git-repository/myproject.git(push)
正如 che的回答中已经提到的有关添加远程部分,我相信你仍然失踪。
关于你在本地添加远程的编辑 USB驱动器。首先你必须有一个'裸仓库',如果你想让你的仓库成为一个共享仓库,也就是能够推/拉/取/合并等等。
要创建一个裸设备/共享存储库,请转到您想要的位置。在你的情况下:
$ cd /卷/ 500gb /
$ git init --bare myproject.git
请参阅 here 获取关于创建裸仓库的更多信息
一旦裸露资源库设置在你想要的位置,你现在可以将它作为远程工具添加到你的工作副本中。
$ p $ git remote add origin / Volumes / 500gb / myproject.git
现在您可以将更改推送至您的存储库
$ git push origin master
I am following the instructions given here to create a Git repository. All went well until the last line:
$ git push -u origin master
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
I'm using git version 1.7.11.3 on OS X 10.6.8
$ git remote -v
returns nothing
Config file for the repository:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
I've had to open sudoers file using sudo visudo command and add the following to it (under # User privilege specification):
git ALL=(ALL) ALL.
Now if I do:
$ git remote add origin /Volumes/500GB/git-repository/myproject.git
it comes back with no error, but I don't see any code in the repository (it has the aforementioned directories like branches, hooks, ...)
If I do:
$ 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)
As it has already been mentioned in che's answer about adding the remote part, which I believe you are still missing.
Regarding your edit for adding remote on your local USB drive. First of all you must have a 'bare repository' if you want your repository to be a shared repository i.e. to be able to push/pull/fetch/merge etc..
To create a bare/shared repository, go to your desired location. In your case:
$ cd /Volumes/500gb/
$ git init --bare myproject.git
See here for more info on creating bare repository
Once you have a bare repository set up in your desired location you can now add it to your working copy as a remote.
$ git remote add origin /Volumes/500gb/myproject.git
And now you can push your changes to your repository
$ git push origin master
这篇关于Git推送错误:“来源似乎不是git存储库”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!