我按照这里给出的说明创建一个Git存储库.一切顺利到最后一行:
$ git push -u origin master
Run Code Online (Sandbox Code Playgroud)
致命:'origin'似乎不是一个
致命的git存储库:远程端意外挂断
我在OS X 10.6.8上使用git版本1.7.11.3
$ git remote -v
Run Code Online (Sandbox Code Playgroud)
没有回报
存储库的配置文件:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
Run Code Online (Sandbox Code Playgroud)
我必须使用sudo visudo命令打开sudoers文件,并在其中添加以下内容(在#User privilege规范下):
git ALL=(ALL) ALL.
Run Code Online (Sandbox Code Playgroud)
如果我这样做:
$ git remote add origin /Volumes/500GB/git-repository/myproject.git
Run Code Online (Sandbox Code Playgroud)
它没有错误,但我没有在存储库中看到任何代码(它有上述目录,如分支,钩子,......)
如果我做:
$ 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)
Run Code Online (Sandbox Code Playgroud)
ro *_* ko 51
正如che在答案中已经提到过添加远程部分,我相信你仍然缺少它.
关于在本地USB驱动器上添加遥控器的编辑.首先,如果您希望您的存储库成为共享存储库,即能够推/拉/获取/合并等,您必须拥有"裸存储库".
要创建裸/共享存储库,请转到所需位置.在你的情况下:
$ cd /Volumes/500gb/
$ git init --bare myproject.git
Run Code Online (Sandbox Code Playgroud)
有关创建裸存储库的更多信息,请参见此处
在所需位置设置裸存储库后,现在可以将其作为远程工具添加到工作副本中.
$ git remote add origin /Volumes/500gb/myproject.git
Run Code Online (Sandbox Code Playgroud)
现在,您可以将更改推送到存储库
$ git push origin master
Run Code Online (Sandbox Code Playgroud)
小智 20
以下是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
Run Code Online (Sandbox Code Playgroud)
这是实际工作的:
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
Run Code Online (Sandbox Code Playgroud)
克隆后,push命令会通过提示输入用户名和密码来成功
小智 14
很可能远程存储库不存在或者您添加了错误的存储库.
您必须先删除原点并重新添加它:
git remote remove origin
git remote add origin https://github.com/username/repository
Run Code Online (Sandbox Code Playgroud)
che*_*che 11
您的配置文件不包含对"origin"远程的任何引用.那部分看起来像这样:
[remote "origin"]
url = git@foo.com:repository.git
fetch = +refs/heads/*:refs/remotes/origin/*
Run Code Online (Sandbox Code Playgroud)
您需要先添加遥控器git remote add
才能使用它.
当你创建一个存储库bitbucket.org,它给你如何设置你的本地目录的说明。很有可能,您只是忘了运行代码:
git remote add origin https://username@bitbucket.org/username/reponame.git
我仍然会谦虚地分享我的简短答案,因为我知道我回答这个问题已经太晚了。
另外,由于我使用的是SSH 密钥,所以我使用了以下命令:
例如它看起来像:
如果您使用的是 HTTPS URL,请参阅上面@sunny-jim提供的答案。
如果我错了请纠正我。谢谢。
归档时间: |
|
查看次数: |
181165 次 |
最近记录: |