1. Create a project locally
2. And created a warehouse on the code cloud, want to link the local warehouse to the remote warehouse
3. Initialize the local warehouse
git init
4. Add remote warehouse address
Note: origin is the repository name/alias
git remote add origin XXX
View remote warehouse address
git remote -v
5. Generate ReadMe file locally
In this step, after the initialization of the new warehouse settings on gitee, there will be one more ReadMe file and another file, because there is no local one, so the push to the remote will be rejected
git pull --rebase origin master
6. Pull the master branch of the remote host origin and merge it with the local brantest branch.
This one is similar to the one above, and we don’t know why there are two such commands, but the tutorial said so, and it really solved my mistake, so I will stay here. Anyway, one more step should not be a big problem.
git pull origin master
7. Add files to the temporary storage area
Note that there is a space between this point and add
git add .
8. View the current file status
git status
9. Add files to the local warehouse
git commit -m " "
10. Specify the remote warehouse name and branch name and submit
git push origin master
11. Force upload to overwrite remote files
git push -f origin master