SourceTree Throws credential-osxkeychain is not a git command Error When Pushing Changes

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

問題

When pushing changes to a repository, the following error appears:

git: 'credential-osxkeychain' is not a git command. See 'git --help'

原因

Git is simply trying to access a credential helper which it can't find. SourceTree uses its own git from version 1.6.3+ and doesn't need the osxkeychain helper provided by Git itself.

Git introduced the concept of credential helpers which are small programs that meet a specified protocol in order to do three things; provide authentication details, save authentication details (perhaps temporarily in memory or to the keychain), and delete authentication details (if they are wrong then you won't want them any longer). Respectively these are called getstore and delete. Credential helpers were introduced in order to solve the problem of authenticating with a remote through Git meaning you can provide custom credential helpers dependent on your needs, for example, you may not want to use the keychain to provide authentication details so instead you could write your own to retrieve them from elsewhere.

When calling 'store' Git will iterate through all credential helpers available based on the preferences set. Git, out-of-the-box, will set 'credential-osxkeychain' to be one of the credential helpers at the system level. This setting can be found set in the global config located at /usr/local/git/etc/gitconfig. If you don't want to use this helper you can delete it as SourceTree as of version 1.6.3 uses its own credential helper in order to provide a GUI to store to the keychain. The error "git: 'credential-osxkeychain' is not a git command. See 'git --help'." occurs because Git calls this helper and cannot find it meaning it has been defined and not yet found on the PATH. In terms of SourceTree as of version 1.6.3 this is nothing to worry about.

回避策

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.

ソリューション

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
最終更新日: 2016 年 2 月 26 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.