git 添加本地已有项目遇到的事

1.移除old git related:

find . -name ".git" | xargs rm -Rf

2.init new git:

git init

3.git绑定新的地址:

git remote add origin "git address"

4.git add .

5.git commit -m "init git"

6.准备pull的时候出现了错误

Auto packing the repository in background for optimum performance.

See "git help gc" for manual housekeeping.

fatal: refusing to merge unrelated histories

先解决gc的问题:

git fsck

git gc --prune=now

然后:

git pull origin master --allow-unrelated-histories

7.继续git pull origin master & git push origin master

 Enjoy it!

你可能感兴趣的:(git 添加本地已有项目遇到的事)