首页 > 解决方案 > 当我落后 1 和 2 领先时,如何将更改提交到存储库?

问题描述

所以我在这个 GitHub 存储库上落后 1 和 2 领先。
当我不得不解决 1 behind 问题时,它给了我这个输出:

git --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch origin 
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.

我不太确定这意味着什么,并希望尽快解决此问题并将一些文件上传到存储库。
我是 GitHub 和 SourceTree 的初学者。

标签: githubrepositoryatlassian-sourcetreegit-commitgit-pull

解决方案


这意味着 SourceTree 使用 SSH 的方式无法在 GitHub 上对您进行身份验证。

首先在命令行中检查是否ssh -T git@github.com有效:请参阅“测试您的 SSH 连接”。

然后检查 sourceTree 设置:如图所示,我建议使用 OpenSSH 客户端,而不是 putty 客户端(假设您使用ssh-keygen -t rsa -P "" -m PEM过生成 ssh 私钥/公钥对,而不是 putty,或者您不在 Windows 上)


推荐阅读