2009-09-30 68 views
7

我在家里克隆了我的GitHub仓库,显然搞砸了。无论如何,我做了很多改变,或者我会擦掉目录,然后再做一遍。无法推送到这个盒子上的GitHub

首先,当我做ssh [email protected]我得到如下:

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。谢谢。

回答

10

在你的.git/config中使用ssh://,而不是git://git://仅用于克隆存储库。直接从我的libcloud库 - 我使用的原因无关的这篇文章“母船”:

[remote "mothership"] 
    url = ssh://[email protected]/jedsmith/libcloud.git 
    fetch = +refs/heads/*:refs/remotes/origin/* 

线索应该是你使用ssh来测试连接...

+1

咄。漫长的一天。谢谢。 – mculp 2009-09-30 02:57:32

+0

我也是,我感觉你。 :) – 2009-09-30 03:01:08

+0

解决这个问题的简单方法是将其添加到您的'〜/ .gitconfig'文件中:https://gist.github.com/412f0b1c8841cceed750 – henrikhodne 2010-12-31 09:58:48