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