SourceTree 将远程凭据添加到本地 git 存储库

SourceTree Add remote credentials to local git repo

我使用 SourceTree(在 OSX 10.11.6 上)创建了本地和远程存储库。

我已将带密码的 SSH 密钥添加到远程存储库

我已将文件添加到本地存储库并提交了具有良好 .ignore 的代码

当我尝试推送时,我得到:

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

那么如何将我刚刚创建的远程仓库的访问权限添加到 SourceTree 中的本地仓库中?

So how do I add my access rights for the remote repo I just created into my local repo in SourceTree?

假设您已将远程存储库添加到本地。
如果您没有添加任何内容,则必须添加 remote:

 git remote add origin <url>

验证 SourceTree 配置是否正确。

转到设置并在 git 下更改为 OPEN SSH 并确保您的密钥如下:~/.ssh/id_rsa

如果仍然无法连接,请尝试启动 ssh agent

eval $(ssh-agent)
ssh-add -l

然后,检查您是否看到您的密钥。如果不是简单地添加它们:

ssh-add ~/.ssh/id_rsa