简体   繁体   中英

git push origin master failed

I want to push my code to github.com.

I use win Xp and git-bash 1.7.2.3

And I got following success message during ssh testing.

But " git push origin master " command require username and password.

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. I think that in Windows, the ssh key resides inside the .ssh folder of your profile ( 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.

Did you set your GitHub id? (since GitHub is based on Token identification )

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

See GitHub Help page .


Regarding Vasileios Lourdas 's answer about ssh, make sure what is the value of $HOME in a git bash session.

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

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

On Xp, that would be c:\\Document And Settings\\VonC .
Meaning your ssh public key file id_rsa.pub must have the path:

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

It may be a problem with using HTTPS interface. Change to the directory and run "git remote -v" to list how your remotes are configured, then post it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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