忽略文件:
<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>
閱讀更多 默默學習 的文章