我有以下用例:我希望能够推送git@git.company.com:gitolite-admin使用用户的私钥gitolite-admin,而我想推送git@git.company.com:some_repo使用"我自己的"私钥.AFAIK,我无法解决这个问题~/.ssh/config,因为在这两种情况下用户名和服务器名都是相同的.由于我主要使用自己的私钥,因此我已将其定义~/.ssh/config为git@git.company.com.有没有人知道一种方法来覆盖用于单个git调用的密钥?
(旁白:gitolite基于密钥来区分谁在进行推送,因此在访问,所有权和审计方面,用户@服务器字符串对于不同的用户来说是相同的.)
我尝试推送到我的存储库,但我收到了以下错误
git push origin master
remote: Permission to PhanVanLinh/phanvanlinh.github.io.git denied to edgarphan.
fatal: unable to access 'https://github.com/PhanVanLinh/phanvanlinh.github.io.git/': The requested URL returned error: 403
Run Code Online (Sandbox Code Playgroud)
之前,我使用的是用户名,edgarphan但我已将其更改为PhanVanLinh但仍保留edgarphan.我试图删除项目并再次克隆,卸载git并重新安装,但它将无法正常工作.
我该如何解决这个问题?任何帮助或建议将非常感谢.