search

Home  >  Q&A  >  body text

github - git can connect successfully, but cannot push or pull. Could you please help me, thank you!

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~~

怪我咯怪我咯2809 days ago1967

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-05-02 09:31:51

    Try switching to https

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

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-02 09:31:51

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

    Change to https or ssh address

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-02 09:31:51

    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

    reply
    0
  • Cancelreply