#第一次git需要的操作
git config --global user.email "532733691@qq.com"
git config --global user.name "wangchao"
#保存git賬號信息到本地
git config --global credential.helper cache
#將pull時,代碼與本地合并
git config --global pull.rebase false
#修改遠程倉庫地址,上傳源碼到新倉庫時使用,
git remote set-url origin http://git.ope.ai:8999/ex/easy-exchange-parent.git
#提交代碼有問題時使用,先刪除舊的提交記錄,然后增加遠程倉庫地址
rm -rf .git
git remote add origin http://git.ope.ai:8999/ex/easy-exchange-parent.git
#允許 Git 合并兩個不相關的項目歷史
git pull origin main --allow-unrelated-histories
#提交代碼操作命令
git add .
git commit -m 'init'
git push origin main
####將已有代碼上傳到新空白gitlab倉庫
新倉庫名:http://git.ope.ai:8999/ex/easy-root.git
#修改遠程倉庫鏈接
git remote set-url origin http://git.ope.ai:8999/ex/easy-root.git
#添加遠程倉庫鏈接
git remote add origin http://git.ope.ai:8999/ex/easy-root.git
#強制推送代碼到對應的分支,你處于test就推到test分支。推所有就是git push -u --all origin
git push -u origin test