Remember once being given Git submit questions

Typically code version control step is:

  • In the code version control platform to create a new warehouse
  • cloneA remote repository to local
  • Start coding, followed by a series of add, commit,push

    My steps are:

  • In remote code version management platform to create a new warehouse
  • Create a new project in the local
  • By git remote addadding a remote repository
  • Then add, commit, push
    but commitwhen on the error:
error: failed to push some refs to ....
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.

This shows that the two warehouses at this time and did not associate the two warehouse code is not synchronized.
Follow the prompts using the git pullpull and merge remote code and error as follows:

 refusing to merge unrelated histories

Means that the history of two unrelated warehouse.

Final Solution:

Allow history irrelevant:

git pull origin master --allow-unrelated-histories

Then again push.

Guess you like

Origin www.cnblogs.com/wotoufahaiduo/p/11669074.html