打开本地项目文件夹
鼠标右键打开Git Bash Here
初始化本地仓库:
git init
初始化完成后,本地文件会生成一个.git文件
将当前目录下所有的修改或新增的文件添加到暂存区
git add .
用于将暂存中的更改创建为一次提交
git commit -m '提交备注名称'
建立本地仓库和远程仓库关系并推送
git remote add origin http://ip地址+端口/路径/(项目名称).git
远程仓库地址:公司的gitlab地址+项目地址(没有端口也可以)
git remote -v
如果连接有误:执行改命令,
git remote rm origin
重新连接
把本地内容推送到远程仓库
git pull --rebase origin master
如果出现: Cloudnot find remote ref master
则:
git push -u origin master
如果出现错误:
$ git push -u origin master
remote: You are not allowed to push code to this project.
fatal: unable to access 'http://101.132.227.235/root/framework.git/': The requested URL returned error: 403
则检查账号:
退出当前账号:
git config --system --unset credential.helper
再执行:
git push -u origin master
推送完成!