github - git can connect successfully, but cannot push or pull. Could you please help me, thank you!
怪我咯
怪我咯 2017-05-02 09:29:51
0
3
1951

After establishing git locally, submit the code to the repository. Ready to upload to github.
Create path:

Birdy-2:learnGit birdy$ git remote add origin http://github.com/timothydsp/learnGit.git
Birdy-2:learnGit birdy$ git push -u origin master
fatal: unable to access 'http://github.com/timothydsp/learnGit.git/': Recv failure: Connection reset by peer

An error started to appear here, unable to connect
Then I tried to see if there was any problem with the link address:

Birdy-2:learnGit birdy$ git remote add origin http://github.com/timothydsp/learnGit.git
fatal: remote origin already exists.

Found no problem, try to connect to github:

Birdy-2:learnGit birdy$ ssh -T git@github.com
Hi timothysdp! You've successfully authenticated, but GitHub does not provide shell access.

If the connection is successful, check whether the local public key exists:

Birdy-2:learnGit birdy$ cd ~/.ssh
Birdy-2:.ssh birdy$ ls
id_rsa        id_rsa.pub    known_hosts

Check whether the online public key is the same:

Birdy-2:learnGit birdy$ pbcopy <~/.ssh/id_rsa.pub

There should be no problem, right? ? ? ? ?
Go here:

Birdy-2:learnGit birdy$ ssh -T git@github.com
Hi timothysdp! You've successfully authenticated, but GitHub does not provide shell access.

Why can’t you push or pull after going around like this?

You can see my projects online here.

Please teach me, seniors, what went wrong?

A brother mentioned changing to HTTPS; or ssh

Birdy-2:learnGit birdy$ git remote add origin https://github.com/timothysdp/learnGit.git
fatal: remote origin already exists.
Birdy-2:learnGit birdy$ git remote add origin git@github.com:timothysdp/learnGit.git
fatal: remote origin already exists.
Birdy-2:learnGit birdy$ git push -u origin master
fatal: unable to access 'http://github.com/timothydsp/learnGit.git/': Recv failure: Connection reset by peer

Looks like it still doesn’t work~~

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(3)
Peter_Zhu

Try switching to https

# 删除旧的origin
git remote remove origin
# 添加https的
git remote add origin https://github.com/timothydsp/learnGit.git
習慣沉默

origin http://github.com/timothydsp/learnGit.git

Change to https or ssh address

巴扎黑
Birdy-2:learnGit birdy$ git remote rm origin
Birdy-2:learnGit birdy$ git remote add origin git@github.com:timothysdp/learnGit.git
Birdy-2:learnGit birdy$ git push -u origin master
Counting objects: 12, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (12/12), 924 bytes | 0 bytes/s, done.
Total 12 (delta 0), reused 0 (delta 0)
To git@github.com:timothysdp/learnGit.git
  • [new branch] master -> master

    Branch master set up to track remote branch master from origin.
    

Okay, it seems that I didn’t pay attention to the error of http and https

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template