This article does not elaborate any conceptual knowledge, just make a note, simply is the use of the steps, if you encounter obstacles, please Google it!

  • Using SSH to Bind Git to GitHub

1. Generate SSH key

ssh-keygen -t rsa

Specify the RSA algorithm to generate the key, after which two files will be generated, id_rsa and id_rsa.pub, i.e., the key id_rsa and the public key id_rsa.pub. For these two files

2. Add SSH key github.com -> Settings -> SSH and GPG -> New SSH key Paste the content of the public key id_rsa.pub into the location of the key (it’s OK if you don’t fill in the content of the Titles), and then click Add SSH key.

3. Verify the binding is successful

ssh -T git@github.com

  • Commands to push local projects to github

(1) Open your catalog

demo cd

(2) Initialize the repository for generating git files.

git init

(3) Add all files to the cache

git add *

(4) Submission of changes to the current workspace

git commit -m “first commit”

(5) Connecting the warehouse to a remote server

git remote add origin (which is the address of your repository above)

(6) Push changes to added servers

git push -u origin master

If the following error occurs while pushing:

warning: redirecting to https://github.com/178146582/dabai.git/ To http://github.com/178146582/dabai.git ! [rejected] master -> master (fetch first) error: failed to push some refs to ‘http://github.com/178146582/dabai.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., ‘git pull …’) before pushing again. hint: See the ‘Note about fast-forwards’ in ‘git push –help’ for details.

Checked the reason for the error is that the README.md file in github is not in the local code directory. So we split step 6 above into two steps:

git pull –rebase origin master: doing a code merge

git push -u origin master