1Git global setup
git config --global user.name xxx git config --global user.email xxx
2Create a new repository
git clone http://git.xx.com/xxx/test.git cd test touch README.md git add README.md git commit -m "add README" git push -u origin master
3Existing folder or Git repository:把其他git分支代碼直接提交到此分支,先刪掉.git文件,
cd existing_folder git init git remote add origin http://git.xxx.com/xxx/test.git git add . git commit git push -u origin master
報錯一:
Reinitialized existing Git repository in F:/workspace/cms/.git/
我是直接 刪除這個 git,然后重新初始化一個
// 進入項目根目錄
// 重新初始化
➜ git init
報錯二 : 執行git push origin master 拋出錯誤refusing to merge unrelated histories
需要添加一個參數 ,完美解決。
➜ git pull origin master --allow-unrelated-histories