忽略文件:
<code>在项目根目录下添加文件.gitignore
.idea/
xxxx
xxx
/<code>
本地已经有文件夹,需要初始化远程仓库
<code>#初始化本地仓库
git init
#将本地内容添加至git索引中
git add .
#将索引添加至本地仓库中
git commit -m "first commit"
#添加远程仓库路径
git remote add origin https://github.com/xxxx/xxx.git
#pull线上仓库
git pull origin master --allow-unrelated-histories
#将本地内容push至远程仓库中
git push -u origin master
#如果提示
fatal: refusing to merge unrelated histories
#解决方案
git pull origin master --allow-unrelated-histori/<code>
閱讀更多 默默學習 的文章