一、在gitlab上新建一个项目
二、进入本地项目目录
初始化:
git init
三、绑定远程的创建的项目
git remote add origin http://xxxx@code.xxxx.com/xxxx/demo.git
若是出错的话,很可能是本地没有权限访问gitlab,可以先本地生成key,传到gitlab上。
四、正常提交
git add .
如果提示: warning: LF will be replaced by CRLF in
windows中的换行符为 CRLF, 而在linux下的换行符为LF,所以在执行add . 时出现提示,解决办法:
git config --global core.autocrlf false
git commit -m “首次提交”
git push -u origin master
四、或 新建其它分支,将项目push到新建的分支上,后期再进行merge
(1)新建分支
git branch 分支名
(2)切换分支
git checkout 分支名
(3)进行项目上传
git add .
git commit -m “提交的信息”
git remote add origin 远程仓库地址
git push -u origin 分支名