1. Use the git command line to upload local code to github
Before uploading, it is necessary to explain related concepts: git is divided into three parts, one is its own files, the other is the cache area, and the last is the local library. The git add xx operation is to add local files to the cache area; the git commit operation is to submit the files in the cache area to the local warehouse; the git push operation is to push the contents of the local warehouse to the remote warehouse.
1. Enter the local project directory, right-click "Git Bash here", bring up the git command line interface, and enter
git init
2. Just add all the files in the directory to the cache area, you can also replace the "." with a specific file name
git add.
3. Submit the files in the above cache area to the local warehouse
git commit -m "comment statement"
4. Go to github to create your own local warehouse repository
5. Associate the local warehouse to github. The following https link is replaced with the warehouse url address I just created on github
git remote add origin https://github.com/yuexijun/myTest.git
6. Pull the remote warehouse before uploading to github, and execute the following command
git pull origin master
7. Upload the code to the github remote warehouse
After the execution of git push -u origin master , if there is no abnormality, the upload is successful after the execution is completed. You may be asked to enter your username and password in the middle, you just need to enter and click to continue.
Second, use the git command line to submit a modified file
Please see the screenshot below for the steps:
If the above git push origin master command is not successful, try this command to git push directly. The push is successful, and I personally test it.
Reference article: http://blog.csdn.net/hanhailong726188/article/details/46738929 https://blog.csdn.net/hanhailong726188/article/details/46738929