所以我有 2 个 GitHub 帐户(1 个工作帐户和 1 个个人帐户),并且我设置了 SSH key 以在 2 台笔记本电脑(1 个工作帐户和 1 个个人帐户)上使用。我在我的个人帐户上创建了一个存储库,并将其克隆到我的工作笔记本电脑上(确保我有正确的 SSH 链接)。但是我忘记将作者设置为我的个人帐户,因此将其设置为全局配置的我的工作帐户名称。现在我似乎无法将存储库克隆到我的个人笔记本电脑,我认为这是因为它具有我的工作帐户的提交。这是我尝试克隆它时遇到的错误:
Cloning into 'notes'...
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="83e4eaf7c3e4eaf7ebf6e1ade0ecee" rel="noreferrer noopener nofollow">[email protected]</a>: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我知道我可以使用 git commit --amend --author="John Doe <<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="660c090e082602090348091401" rel="noreferrer noopener nofollow">[email protected]</a>>"
更改作者但是如果没有克隆的存储库我该怎么办?有没有办法不使用终端来做到这一点?
最佳答案
通过使用 https url 而不是 SSH 进行克隆解决了这个问题。
关于git - 如何在不使用终端的情况下更改现有 git 提交的作者?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50163915/