git appears fatal: refusing to merge unrelated histories error

quote


git pull fails, prompt: fatal: refusing to merge unrelated histories

In fact, this problem is because two git libraries are not related at all, one is a local library and the other is a remote library, and then the local is going to push to the remote, the remote feels This local library has nothing to do with itself, so it is told that the

specific , one by one: pull down the code from the remote library, put the code to be added locally into the remote library, download it to the local library, and then submit it, because In this case, the library you are based on is the remote library. This is an update.

The second method:
use this mandatory method
git pull origin master --allow-unrelated-histories
followed by --allow-unrelated-histories, Forcibly merge two unrelated branches and push them

later . git push gitlab master:init

gitlab is an alias, use
git remote add gitlab ssh://[email protected]:50022/opt/gitrepo/withholdings/WithholdingTransaction


master is the name of the local branch
init is the name of the branch to be pushed from the remote end. The

local must be added first, and the commit can only be pushed up. For


this issue, please refer to http://stackoverflow.com/questions/37937984/git-refusing-to- merge-unrelated-histories.

When doing a git pull, add an optional

git pull origin master --allow-unrelated-histories

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326196545&siteId=291194637