我在家里克隆了我的GitHub存储库,显然搞砸了。无论如何,我做了很多改动,或者我要删除目录并再次完成所有操作。
首先,当我ssh git@github.com
时,我得到以下内容:
PTY allocation request failed on channel 0
ERROR: Hi asdfadfs! You've successfully authenticated, but GitHub does not provide shell access Connection to github.com closed.
我收到错误,但是说我已成功通过身份验证了吗?
git add .
git commit -a -m "hello"
git push origin master
[master 74a5e82] hello
3 files changed, 45 insertions(+), 12 deletions(-)
fatal: The remote end hung up unexpectedly
这显然不起作用。而且我是git的新手,所以现在当我尝试提交时会发生这种情况:
git add .
git commit -a -m "hello"
git push origin master
# On branch master
nothing to commit (working directory clean)
fatal: The remote end hung up unexpectedly
最后,git pull
?
$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me either. Please
specify which branch you want to merge on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
configure the following variables in your configuration
file:
branch.master.remote = <nickname>
branch.master.merge = <remote-ref>
remote.<nickname>.url = <url>
remote.<nickname>.fetch = <refspec>
See git-config(1) for details.
这是我的.git / config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[branch "master"]
[remote "origin"]
url = git://github.com/my/project.git
fetch = +refs/heads/*:refs/remotes/origin/*
该url变量实际指向我正确的git url。感谢。
答案 0 :(得分:10)
在.git / config中使用ssh://
,而不是git://
。 git://
仅用于克隆存储库。直接从我的libcloud存储库 - 我使用“母舰”的原因与此帖无关:
[remote "mothership"]
url = ssh://git@github.com/jedsmith/libcloud.git
fetch = +refs/heads/*:refs/remotes/origin/*
线索应该是你正在使用ssh来测试你的连接......