简体   繁体   English

git push origin master 失败

[英]git push origin master failed

I want to push my code to github.com.我想将我的代码推送到 github.com。

I use win Xp and git-bash 1.7.2.3我使用 win Xp 和 git-bash 1.7.2.3

And I got following success message during ssh testing.我在 ssh 测试期间收到了以下成功消息。

But " git push origin master " command require username and password.但是“ 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`

You have to create a ssh key and upload the public key to github, so that it will be able to authenticate you using the key.您必须创建一个 ssh 密钥并将公钥上传到 github,以便它能够使用该密钥对您进行身份验证。 I think that in Windows, the ssh key resides inside the .ssh folder of your profile ( c:\\documents and settings\\<username> ).我认为在 Windows 中,ssh 密钥位于您的配置文件的 .ssh 文件夹内( c:\\documents and settings\\<username> )。 So, create the key and upload the contents of id_rsa.pub (this is the name unless you change it) to Github.因此,创建密钥并将 id_rsa.pub 的内容(这是名称,除非您更改它)上传到 Github。

Did you set your GitHub id?你设置了你的 GitHub id 了吗? (since GitHub is based on Token identification ) (因为 GitHub 是基于Token 识别的

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

See GitHub Help page .请参阅GitHub 帮助页面


Regarding Vasileios Lourdas 's answer about ssh, make sure what is the value of $HOME in a git bash session.关于Vasileios Lourdas关于 ssh 的回答,请确保$HOME在 git bash 会话中的值是多少。

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

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

On Xp, that would be c:\\Document And Settings\\VonC .在 Xp 上,这将是c:\\Document And Settings\\VonC
Meaning your ssh public key file id_rsa.pub must have the path:这意味着您的 ssh 公钥文件 id_rsa.pub 必须具有以下路径:

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

It may be a problem with using HTTPS interface.使用HTTPS接口可能有问题。 Change to the directory and run "git remote -v" to list how your remotes are configured, then post it.切换到目录并运行“git remote -v”以列出您的遥控器的配置方式,然后发布它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM