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 get, store 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