git的时候遇到错误问题及解决方法总结

1、在git push的时候遇到该问题:remote: GitLab: You are not allowed to push code to protected branches on this project.

解决办法:说明你没有权限,首先要把你的内容导入自己的项目,再merge request 

git remote set-url origin http://xxxxx/wangmengmeng/name.git

git push origin master

2、在git push origin master时出现该问题: 

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'http://xxxx/xx/name.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

解决办法:输入 git pull origin master

3、通过pycharm的teminal上传代码的步骤:

1、git status   //查看修改了哪些内容

2、git add --all //添加所有修改的文件

3. git commit -m "first commit" //添加文件描述信息

4、git remote add origin + 远程仓库地址 //链接远程仓库,创建主分支(你可以修改的远程仓库,一般是自己的仓库)

5、git pull origin master // 把本地仓库的变化连接到远程仓库主分支

6、git push  origin master //把本地仓库的文件推送到远程仓库

4、 当上传的时候出现分支已存在,无法上传时,则在标题上的前面加上 WIP:

      WIP: Master修改冲突等问题

 

你可能感兴趣的:(gitlab)