git 报错 You are not allowed to push code to this project 的解决办法

You are not allowed to push code to this project

Please make sure you have the correct access rights
and the repository exists.

昨天往自己的项目分支上 push 代码的时候,出现了上面的提示。

说我不允许往这个项目上推送代码,请确定我有相应的权限并且该仓库存在。

我想,这不是废话嘛…


还是不废话了,直接写解决办法。

git config user.name

查看一下用户名


git config user.email

查看一下邮箱


ssh -T git@github.com

用 ssh 连接一下 git 仓库,看看你现在到底是用哪个用户登录的…


检查了之后发现,原来是我自己使用了错误的用户,所以才没办法往远程的仓库 push 代码…

(手动滑稽)(逃


我当时用的是 github 的 git shell,后来换成 git bash ,重新设置了一下 name 和 email 就好了


估计用 ssh-add 重新添加以下私钥也是可以的吧

具体可参考

ssh-key 与 git账户配置以及多账户配置
http://www.cnblogs.com/dubaokun/p/3550870.html

Github push 常见报错解决方案
http://laker.me/blog/2015/09/18/15_0918_Git_push_errors/

You are not allowed to push code to this project….! [remote rejected] master -> master (pre-receive hook declined)
https://gitlab.com/gitlab-com/support-forum/issues/207


补充

还可以参考一下这种方法

这里写图片描述

多个git账户和项目切换
http://blog.csdn.net/jdk137/article/details/17579837


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值