git push origin master失败了

时间:2010-09-19 12:29:34

标签: git github

我想将我的代码推送到github.com。

我使用win Xp和git-bash 1.7.2.3

我在ssh测试期间获得了以下成功消息。

但“git push origin master”命令需要用户名和密码。

debug1: Entering interactive session.  
ERROR: Hi xxx! You've successfully authenticated, but GitHub does not provi
de shell access  
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0  
debug1: channel 0: free: client-session, nchannels 1  
Connection to github.com closed.  
debug1: Transferred: stdin 0, stdout 0, stderr 34 bytes in 0.7 seconds  
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 51.8  
debug1: Exit status 1

rafael@NETBOOK-RAFAEL /d/project/clojure/anagram (master)

$ git push origin master

Username:

`fatal: Could not read password: No such file or directory`

3 个答案:

答案 0 :(得分:1)

您必须创建一个ssh密钥并将公钥上传到github,以便它能够使用密钥对您进行身份验证。我认为在Windows中,ssh密钥位于您的配置文件(c:\documents and settings\<username>)的.ssh文件夹中。因此,创建密钥并将id_rsa.pub的内容(除非您将其更改)上传到Github。

答案 1 :(得分:0)

您是否设置了GitHub ID? (因为GitHub基于Token identification

git config --global github.user "your-github-username"
git config --global github.token "your-github-token"

请参阅GitHub Help page


关于Vasileios Lourdas关于ssh的answer,请确保git bash会话中$HOME的值是多少。

VonC@VONC ~
$ pwd
/c/Users/VonC

Vonc@VONC ~
$ echo $HOME
/c/Users/VonC

在Xp上,那将是c:\Document And Settings\VonC 这意味着您的ssh公钥文件id_rsa.pub必须具有路径:

 c:\Document And Settings\VonC\.ssh\id_rsa.pub

答案 2 :(得分:0)

使用HTTPS接口可能存在问题。切换到目录并运行“git remote -v”列出你的遥控器的配置方式,然后发布。