-->

GitHub for Mac error: git: 'credential-osxkeyc

2019-03-24 03:22发布

问题:

When using the GitHub for Mac app (version 87), I received the following error:

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

error: The requested URL returned error: 403 while accessing https://github.com/[PROJECT URL]/info/refs

fatal: HTTP request failed (256)

The git command-line tools (version 1.8.0) are installed at /usr/local/git/bin and git-credential-osxkeychain was correctly installed at /usr/local/git/bin.

How can I solve this error?

回答1:

The source of this problem is that GitHub for Mac uses a different directory path for its executables than the Command Line Tools.

GitHub for Mac: /Applications/GitHub.app/Contents/Resources/git/bin

Command Line Tools: /usr/local/git/bin/

So when GitHub for Mac tries to Sync a Branch it presents the error because it can not find git-credential-osxkeychain executable file.

To solve the problem:

  1. Launch Terminal
  2. Create a Symbolic Link for git-credential-osxkeychain from Command Line Tools Dir to GitHub for Mac Dir

ln -s <git-command-line-tools dir path>/git-credential-osxkeychain <github for mac path>/git-credential-osxkeychain

This is the command I used on my system:

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



回答2:

this always happens with source tree app and the solution that you change the settings to use the system git not the embedded git with source-tree because source tree is using an older version or you can update the settings with the path to git executable and you should find it in /usr/bin/git or you can print which git and point your Source tree app to use it



回答3:

Setting

/usr/local/git/bin/git-credential-osxkeychain

in your path also works, or wherever your path may be.

I'm not sure which solution is preferable though.



回答4:

After having worked through this with one of my colleagues we were able to resolve by simply updating SourceTree to the latest version.

For future viewers, before going down the symlink path, make sure you have automatic updates enabled for source tree (preferences->update tab), and then check for updates (in the source tree menu on macs)



回答5:

I had to do sudo ln -s /usr/local/git/bin/git-credential-osxkeychain /usr/bin/git-credential-osxkeychain because I upgraded git and then copied /usr/local/git/bin/git to /usr/bin/git



回答6:

Try : git config --global credential.helper git



回答7:

git: 'credential-osxkeychain' is not a git command. See 'git --help'. this error message's gone after I upgraded git, with

brew upgrade git

==> Upgrading 1 outdated package:
git 2.11.1 -> 2.21.0


回答8:

http://backlogtool.com/git-guide/cn/reference/trouble-shooting.html

HTTPS requires passwords every time you execute push/pull if you are windows,Just for the first time

but in Mac, you can use the authentication assistant connected with the key chain. Users using Homebrew automatically install authentication assistants when installing Git. In addition, you need to install manually.

If you want to verify that you have an installation certification assistant, you can use the following command to confirm.

git credential-osxkeychain

If the authentication assistant is not installed, the following contents are displayed.

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

At this point, you can download the authentication assistant to the right path.

  1. curl -s -O http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain
  2. chmod u+x git-credential-osxkeychain
  3. mv git-credential-osxkeychain /usr/local/bin

After installation, set the open authentication assistant.

  1. git config --global credential.helper osxkeychain