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修改冲突等问题

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序小K

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值