1

我正在使用Atlassian的SourceTree在Mac OS上使用git,并选择AWS CodeCommit作为远程托管服务器。未能将SourceTree连接到AWS CodeCommit

以下这些steps对于HTTPS AWS和我的本地回购之间的连接,

,这里是我git config --global --edit看起来像:

enter image description here

然后尝试克隆从AWS到SourceTree创建的空回购: enter image description here

我得到错误信息打印出来:

abort: HTTP Error 403: Forbidden aws --profile default codecommit credential-helper [email protected] get: aws: command not found fatal: unable to access ' https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my-git-repo/ ': The requested URL returned error: 403

UPDATE

试图通过@Steffen欧宝提供的答案,并得到更象:

enter image description here

我错过了什么?

+0

您能解决此问题吗? – Metallikanz

回答

1

我没有测试过这一点,但考虑到AWS CodeCommit利于credential helper太和误差为command not found,我会假设你被SourceTree知识库文章中列出的相同问题的影响Credential helpers "git: 'credential-osxkeychain' is not a git command. See 'git --help'."

The error [...] occurs because Git calls this helper and cannot find it meaning it has been defined and yet not found on the PATH. In terms of SourceTree as of version 1.6.3 this is nothing to worry about. There's two ways to stop this from happening.

  1. Not recommended, but if you're solely using SourceTree for everything you could remove the 'credential' setting from the /usr/local/git/etc/gitconfig config. This is a quick and easy method, but it does mean operations at the terminal may not be able to authenticate.
  2. Recommended, create a symlink between git-credential-osxkeychain in the SourceTree app resources and your local git install.

    ln -s /usr/local/git/bin/git-credential-osxkeychain /Applications/SourceTree.app/Contents/Resources/git_local/bin/git-credential-osxkeychain

当然,因为AWS CodeCommit需要凭证帮手到位,唯一的解决方法2是概念适用于您的情况,您需要调整链接源和目标为适用于CodeCommit凭证帮手。

+0

试过了,你会检查更新吗? – bluenowhere

+1

不知道这是否有帮助,但我使用塔2.我得到了同样的错误。我去了git config设置,并告诉Tower使用我使用brew,/ usr/local/bin/git(v2.6.3)安装的git,它开始为我工作。 – chris

0

似乎是正确的。 “找不到命令”就是问题所在。 我会说aws不在路径中,当凭证助手试图帮助它找不到它时。仔细检查它的路径做which aws

+0

它是'usr/local/bin/aws',顺便说一句我试图用命令行工具将远程repo克隆到本地机器,并手动添加到SourceTree,它工作正常,我成功地将文件推送到SourceTree中的AWS。那是什么意思? – bluenowhere

0

我刚刚发现这个答案在这里(https://geekprotem.com/2015/07/10/aws-codecommit-with-sourcetree/

继亚马逊网站AWS CLI的安装步骤后,最后一步得到这个工作是编辑在SourceTree我的仓库的配置文件包括以下内容:

[credential] 
helper = /usr/local/bin/aws codecommit credential-helper [email protected] 
UseHttpPath = true 
+0

谢谢。对于Windows,我必须将'helper =“C:/Progra~1/Amazon/AWSCLI/aws.exe”codecommit credential-helper $ @'。希望它对任何人都有帮助。 –