One: First, you need to log in to github to create an account, and then download Git Bash locally
Two: Then create an ssh key locally
Execute the command ssh-keygen -t rsa -C email in git bash
For example: ssh-keygen -t rsa -C "[email protected]" After that, the ssh generation path will be displayed, you can just press Enter, and the final result is as follows
After completion, a .ssh file will be generated
Three: Enter the github account, Settings ==>SSH and GPG keys==》new SHH key
Copy the content in the id_rsa.pub file in the generated .ssh and fill it in.
Verify success ssh -T [email protected]
Then set username and email
git config --global user.name "xinhan"
git config --global user.email "888888@qq.com"
Four: Enter the project that needs to be uploaded, right click Git Bash Here
git init
Turn this project into a warehouse that can be managed by Git through commands
Use the git add command to tell Git to add the files under the project to the warehouse
git remote add origin https://github.com/xinhan/myPrivateGit.git
Submit the file to the warehouse through git commit
Five: Enter git remote add origin to associate the local warehouse to GitHub, and then enter git push -u origin master
to upload the code to GitHub
After entering the last command, the login window will appear, just enter your github account password
You can see the uploaded file in the github account