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