The last time we talked about how to upload a local repository to GitHub, this time we talked about how to merge remote and Local repositories.
First, create a remote repository. Check the README setting when creating the repository.
The created remote repository is not empty.
Then we create a local repository locally and init and commit (the red line is where I typed it wrong)
Then associate the remote repository. Here we can find the SSH link and copy it.
Then let's try the push, and a very disturbing result will appear.
This is because the official introduction of blabla... I am not arrogant (I cannot understand it anyway). In short, your local warehouse and remote warehouse are not synchronized,
That is to say, the remote warehouse stores your latest changes, but you do not have a record of that change in the Local warehouse. He will think that the local warehouse is old (expired) and therefore refuse to push.
My current solution is to use the pull command. For details, visit the official website. Here we introduce the http://www.ruanyifeng.com/blog/2014/06/git_remote.html
This command combines the remote Branch file with the local branch, that is, it pulls remote updates not found locally from the server,
Run the following command:
git pull origin master
The role of this command is to pull the master branch of the remote origin repository and merge it with the local branch, and update the local branch.
Then we can see that the local readme. md file is added:
Now that the update is complete, we can push it,
We can see that the operation is successful. Now let's take a look at it on GitHub,
Submitted successfully.
Git synchronizes local and remote Repositories