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~~
Try switching to https
origin http://github.com/timothydsp/learnGit.git
Change to https or ssh address
[new branch] master -> master
Okay, it seems that I didn’t pay attention to the error of http and https