尝试在 OSX 上安装 git: cannont exec 'git-credential-osxkeychain': Permission denied`

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10867946/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 06:59:58  来源:igfitidea点击:

Trying to install git on OSX: cannont exec 'git-credential-osxkeychain': Permission denied`

macosgitinstallation

提问by tr3online

I'm attempting to install Git on my new MBP and am following the documentation @ https://help.github.com/articles/set-up-git.

我正在尝试在我的新 MBP 上安装 Git,并且正在关注文档@ https://help.github.com/articles/set-up-git

I seem to have hit a snag at the point where it says : If you do not have the helper, you can download it and copy it to /usr/local/bin

我似乎在它说的地方遇到了障碍: If you do not have the helper, you can download it and copy it to /usr/local/bin

I navigated to /usr/local/bin in terminal and did a sudo wget [link to osxkeychain]. When I try to do a git config --global credential.helper osxkeychainI get a fatal: cannont exec 'git-credential-osxkeychain': Permission denied.

我导航到终端中的 /usr/local/bin 并执行了 sudo wget [link to osxkeychain]。当我尝试做 a 时,git config --global credential.helper osxkeychain我得到了一个fatal: cannont exec 'git-credential-osxkeychain': Permission denied.

What did I do wrong?

我做错了什么?

Thanks!

谢谢!

Tre

特雷

采纳答案by nathancahill

Make the downloaded file executable:

使下载的文件可执行:

chmod 755 git-credential-osxkeychain

回答by powtac

Download the git-credential-osxkeychainfile to your desktop(!).
Open the Terminal application.
Type in the following:

git-credential-osxkeychain文件下载到您的桌面(!)。
打开终端应用程序。
输入以下内容:

sudo cp  ~/Desktop/git-credential-osxkeychain /usr/local/bin/git-credential-osxkeychain  
sudo chmod 755 /usr/local/bin/git-credential-osxkeychain  
sudo git config --global credential.helper osxkeychain

Test it with:

测试它:

sudo git credential-osxkeychain

See the sudoprefix? It seems to be required for the credential stuff... It should now output Usage: git credential-osxkeychain <get|store|erase>

看到sudo前缀了吗?它似乎是凭据内容所必需的......现在应该输出Usage: git credential-osxkeychain <get|store|erase>

回答by Synchro

Homebrew's git package sets this up; just:

Homebrew的 git 包设置了这个;只是:

brew install git

brew install git

and you're away.

你走了。

回答by Guru Govindan

One of the common mistakes made by people starting on git is that they have the wrong executable for the operating system.

人们开始使用 git 时常犯的错误之一是他们对操作系统的可执行文件有误。

Please make sure that when you go to git help setup page you click on the right link

请确保当您进入 git 帮助设置页面时,您单击了正确的链接

for example the following link has MAC | WINDOWS | LINUX | ALL options in the top of the page which is small enough to be ignored by many.

例如以下链接有 MAC | 窗口 | 操作系统 | 页面顶部的所有选项都小到可以被许多人忽略。

  https://help.github.com/articles/set-up-git

This has happened to many of my team member to install osx for ubuntu and end up getting the error mentioned above

这发生在我的许多团队成员为 ubuntu 安装 osx 并最终得到上述错误

回答by SurenNihalani

Tried sudo?

试过sudo?

/usr/bin is protected. Or you could try downloading git executables somewhere on your laptop and add that location to your PATH.

/usr/bin 受到保护。或者,您可以尝试在笔记本电脑上的某个位置下载 git 可执行文件,并将该位置添加到您的 PATH 中。