PS: too many projects need to be maintained, at the time of development projects, we may be able to modify the code, but sometimes will meet, is the code of this kind of circumstance, want to see a time without version control, you may need to be constantly backup timing code, but it obviously is very troublesome, and the backup is not necessarily good, For example, if the code has not changed at some point in time, the backup is repeated; Or maybe you backed up the code, but you don’t know the difference between the two versions. In addition, team members can achieve the purpose of collaborative development.

Submit the complete process:

  • 1. Create a Github repository
  • 2. Install the Git client
  • 3. Set the SSH key for the Github account
  • 4. Upload the local project to Github

Create a Github repository

Github’s official website: github.com

If you don’t have an account, get one.

Click Sign in to enter the login screen and enter your account and password to log in to Github. Create a repository — simply create a new space to store our project code.

Install the Git client

Git can be downloaded at git-scm.com/downloads

3. Set SSH keys for Github accounts

Git binding users

Git config --global user. Email "[email protected]" git config --global user.Copy the code

2. Generate an SSH key

SSH -keygen -t rsa -c "[email protected]" #PS: SSH SSH -t [email protected] #PS: You've successfully authenticated indicates that the connection is successfulCopy the code

4. Upload local projects to Github

Git add. # commit to local git commit -m "commit description" # add origin to local git remote Git push -u origin master git push -u origin master git push -u origin masterCopy the code

Common commands

Git push -u origin master -f git push -u origin master -f git remote Git branch # create a local branch git branch v1 # switch to a local branch git checkout v1Copy the code