使用与gcloud源回购克隆一个仓库找不到credential-gcloud.sh

问题描述:

同步时在GitHub上桌面的存储库与gcloud source repos clone <repository>克隆以下错误出现在Mac OS X 10.11(酋长):使用与gcloud源回购克隆一个仓库找不到credential-gcloud.sh

git: 'credential-gcloud.sh' is not a git command. See 'git --help'. 
2016-08-04 07:44:06.598 GitHub Desktop Login[809:15686] AskPass with arguments: (
    "/Applications/GitHub Desktop.app/Contents/MacOS/GitHub Desktop Login", 
    "Username for 'https://source.developers.google.com': " 
) 
2016-08-04 07:44:06.645 GitHub Desktop Login[809:15686] Error getting keychain item for source.developers.google.com: The specified item could not be found in the keychain. 
error: unable to read askpass response from '/Applications/GitHub Desktop.app/Contents/MacOS/GitHub Desktop Login' 
fatal: could not read Username for 'https://source.developers.google.com': Device not configured 
(128) 

原因是无法在PATH上找到gcloud SDK随附的凭证助手git-credential-gcloud.sh。

幸运的是,git不仅可以调用和检测PATH中的凭证助手,还可以在指定完整路径时接受和调用命令。

改变credential.helper来自:

credential.helper="gcloud.sh" 

到:

credential.helper=/<PATH-TO-GCLOUD-SDK>/bin/git-credential-gcloud.sh 

通过调用

git config credential.helper /<PATH-TO-GCLOUD-SDK>/bin/git-credential-gcloud.sh 

解决的具体存储库中的问题。