【发布时间】:2021-11-10 00:23:27
【问题描述】:
我查找了其他问题,但没有得到与答案提供的相同结果。
我最初使用 https 使用 github 存储库备份了我的 DigitalOcean droplet。
我已按照https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/about-ssh 的所有说明(多次)进行操作
我已删除旧的 .git 文件夹。 我根据以下内容更新了 ~/.ssh/config 文件: How to permanently add a private key with ssh-add on Ubuntu?
每次我推送或“git push --set-upstream origin main”时,我都可以选择输入我的用户名和密码,然后因为使用 https 而被拒绝。
我还将我的 ~/.ssh/config 文件更新为:
HostName github.com
User git
IdentityFile ~/.ssh/yourPrivateKeyName
IdentitiesOnly yes
【问题讨论】:
-
您是否将远程 URL 更改为使用 SSH 而不是 HTTPS?听起来不像你做的
-
Git 存储库不是进行备份的好方法,GitHub 不会感谢您使用他们的备份服务。您最好使用旨在以有效方式进行备份的真正备份解决方案(例如 bup 或 Tarsnap)。