我收到这个错误git@github.com:权限被拒绝(公钥),当我在新的mac上gitpush时



我得到了一个新的mac,所以我从旧的mac复制了一个文件并粘贴到新的mac中,然后进行了一些更改,然后输入命令"git-push";我收到这个错误信息

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

对于这个特定的文件,在我的旧mac中,每当我git-push时,我总是必须输入密码短语。其他转发,我不需要输入密码。所以我把它设置得与其他人不同。那是几年前的事了,所以我忘了我是怎么设置的。我的猜测是这个问题和SSH密钥有关,但我不确定我需要做什么才能让这个回购在新的macbook中再次工作。我需要做什么?

您没有正确设置ssh密钥(或者根本没有设置(。您需要将ssh私钥从旧Mac复制到新Mac。您所需要的一切都将在~/.ssh的一个目录中。

复制文件夹的一种方法:http://www.techkaki.com/migrate-ssh-keys-from-one-mac-computer-to-another/

如果需要新的ssh密钥,请按照以下步骤操作:https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

最新更新