[英]git pushing to wrong remote repo
I have two github user accounts. 我有两个github用户帐户。 I created a repo in github with
USER1
credentials. 我在github中使用
USER1
凭据创建了一个仓库。 I followed the below commands to push my local repo to the remote repo: 我按照以下命令将本地存储库推送到远程存储库:
git remote add origin https://github.com/USER1/USER1_REMOTE_REPO.git
git push -u origin master
But I get this error: 但是我得到这个错误:
remote: Permission to USER1/USER1_REMOTE_REPO.git denied to **USER2**.
fatal: unable to access
'https://github.com/USER1/USER1_REMOTE_REPO.git/': The requested URL
returned error: 403
I am not able to figure out why USER2
is shown here. 我无法弄清楚为什么在这里显示
USER2
。 I have also tried regenerating the SSH keys. 我也尝试过重新生成SSH密钥。
Maybe more details can help to narrow the responses but are you sure your git config user.name
or git config user.email
are correct? 也许更多细节可以帮助缩小响应范围,但是您确定
git config user.name
或git config user.email
是正确的吗? I mean, you have to match the user.name & user.email with the ones in the repo if not maybe the wrong ssh keys are beeing used. 我的意思是,如果未使用错误的ssh密钥,则必须将user.name和user.email与回购中的匹配。
EDIT : If this is your problem use git config user.name usernameWanted
and git config user.email emailwanted
If you want to use this settings globally add -g param (eg git config --global user.name
) 编辑 :如果这是您的问题,请使用
git config user.name usernameWanted
和git config user.email emailwanted
如果您想全局使用此设置,请添加-g参数(例如git config --global user.name
)
Hope it helps! 希望能帮助到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.