git pull 上的 OSX 10.10 优胜美地测试版:git-sh-setup:没有这样的文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24022582/
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-10 18:09:37  来源:igfitidea点击:

OSX 10.10 yosemite beta on git pull: git-sh-setup: No such file or directory

gitzshosx-yosemite

提问by meghaphone

After upgrading to OSX 10.10 Yosemite Beta, running git pullis returning the following error:

升级到 OSX 10.10 Yosemite Beta 后,运行git pull返回以下错误:

/Library/Developer/CommandLineTools/usr/libexec/git-core/git-pull: line 11: git-sh-setup: No such file or directory

/Library/Developer/CommandLineTools/usr/libexec/git-core/git-pull: line 11: git-sh-setup: No such file or directory

I've checked the referenced git-core directory and the git-sh-setup.sh is there.

我已经检查了引用的 git-core 目录,并且 git-sh-setup.sh 就在那里。

Other git commands are working exactly as expected

其他 git 命令完全按预期工作

回答by pilif

I think the cleanest solution for this for now is to change the initial command in your iTerm session to be

我认为目前最干净的解决方案是将 iTerm 会话中的初始命令更改为

/usr/bin/login -f <your user name>

This fixes the issue for me.

这为我解决了这个问题。

A further data point for analysis of the issue: It seems that in 10.10, multiple copies of the PATH environment variable exist and subshells seem to prefer the second copy.

分析问题的另一个数据点:似乎在 10.10 中,存在 PATH 环境变量的多个副本,并且子 shell 似乎更喜欢第二个副本。

You can reproduce this by launching any cocoa application on the console as launched by iTerm. You'll get a warning that looks like this:

您可以通过在 iTerm 启动的控制台上启动任何可可应用程序来重现这一点。您将收到如下所示的警告:

2014-06-04 19:23:09.859 gitx[14676:362580] *** -[NSProcessInfo environment]: Warning: duplicate definition for key 'PATH' found in environment -- subsequent definitions are ignored.  The first definition was '(the path I have configured in my shell)', the ignored definition is '/usr/bin:/bin:/usr/sbin:/sbin'.

I believe this to be a problem in 10.10 and not iTerm, but something iTerm is doing is causing it to manifest itself (this doesn't happen in Terminal.app)

我相信这是 10.10 中的问题,而不是 iTerm,但 iTerm 正在做的事情导致它自己表现出来(这不会发生在 Terminal.app 中)

Update: This is caused by iTerm doing "interesting" stuff to the environment. Update to the official release of iTerm 2.0 to make this problem go away.

更新:这是由 iTerm 对环境做“有趣”的事情引起的。更新到 iTerm 2.0 的官方版本,使这个问题消失。

回答by Jeremy Huddleston Sequoia

I believe this is a bug in iTerm when using zsh. They deliberately don't invoke /usr/bin/login, and they don't use execle to clear the environment variables like they should be.

我相信这是使用 zsh 时 iTerm 中的一个错误。他们故意不调用/usr/bin/login,也不像应有的那样使用execle清除环境变量。

回答by Marthyn Olthof

Downloading the newest version of iTerm2 fixed this for me!

下载最新版本的 iTerm2 为我解决了这个问题!

回答by Feng

Another solution, modify your iTerm2

另一种解决方案,修改你的iTerm2

cd /Applications/iTerm.app/Contents/MacOS
mv iTerm iTerm-bin

cat > iTerm <<EOF
#!/bin/sh
unset PATH
${0}-bin
EOF

chmod +x iTerm

Done.

完毕。

Enjoy your iTerm2 with Yosemite!

在优胜美地享受您的 iTerm2!

回答by Ubiquill

As a temp solution I modified git-pull lines 11, 12, and 336 to be:

作为临时解决方案,我将 git-pull 第 11、12 和 336 行修改为:

. /usr/local/Cellar/git/2.0.0/libexec/git-core/git-sh-setup

. /usr/local/Cellar/git/2.0.0/libexec/git-core/git-sh-i18n

eval="/usr/local/Cellar/git/2.0.0/libexec/git-core/git-merge $diffstat $no_commit $verify_signatures $edit $squash $no_ff $ff_only"

This fixes git-pull for now, but I'm sure there is a better solution.

这暂时修复了 git-pull,但我确定有更好的解决方案。

回答by jbnunn

Here's a temporary fix (assuming Homebrew and Git 2.0.0) if you need Git to work before an official fix comes out. I setup two shell variables:

如果您需要 Git 在官方修复发布之前工作,这里有一个临时修复(假设 Homebrew 和 Git 2.0.0)。我设置了两个shell变量:

export GIT_PATH="/usr/local/Cellar/git/2.0.0/bin"
export GIT_CORE_PATH="/usr/local/Cellar/git/2.0.0/libexec/git-core"

... and then replaced instances of gitwith appropriate absolute links. You can use the following Gists to do the same:

...然后git用适当的绝对链接替换实例。您可以使用以下 Gists 来做同样的事情:

  • Replace /usr/local/Cellar/git/2.0.0/libexec/git-core/git-sh-setup/with git-sh-setup
  • Replace /usr/local/Cellar/git/2.0.0/libexec/git-core/git-stash/with git-stash
  • Replace /usr/local/Cellar/git/2.0.0/libexec/git-core/git-pull/with git-pull
  • git-sh-setup替换/usr/local/Cellar/git/2.0.0/libexec/git-core/git-sh-setup/
  • git-stash替换/usr/local/Cellar/git/2.0.0/libexec/git-core/git-stash/
  • git-pull替换/usr/local/Cellar/git/2.0.0/libexec/git-core/git-pull/

This is a hack for sure, but it will get you going.

这肯定是一个黑客,但它会让你继续前进。

EDIT: Make sure you look at the answer from @pilif before doing this...

编辑:确保在执行此操作之前查看@pilif 的答案...

回答by ferchak

Ubiquill's workaround applies for git rebase (and presumably whichever other functions don't work) as well. In that case, it requires replacing lines 47 and 48 with the following *:

Ubiquill 的解决方法也适用于 git rebase(可能还有其他功能不起作用)。在这种情况下,它需要用以下 * 替换第 47 和 48 行:

. /usr/local/Cellar/git/2.0.0/libexec/git-core/git-sh-setup
. /usr/local/Cellar/git/2.0.0/libexec/git-core/git-sh-i18n

* This path assumes that you have git installed with homebrew, and it lives inside of /usr/local/Cellar/git/2.0.0/.

* 这个路径假设你已经安装了 Homebrew 的 git,它位于 /usr/local/Cellar/git/2.0.0/ 中。

回答by pyrou

Edit your git-pull file and add this line on top of it (just after the comment block)

编辑您的 git-pull 文件并在其顶部添加这一行(就在注释块之后)

PATH="$(dirname 
ed -s $(which git-pull) <<< $'6i\nPATH="$(dirname ##代码##):$PATH"\n.\nwq'
):$PATH"

Or just copy paste this in your terminal :

或者只是将其复制粘贴到您的终端中:

##代码##

Update:As presumed by pilif, since last iTerm2 update (1.0.0.20140629), git-pullrun properly without this PATHoverride.

更新:pilif推测,自上次 iTerm2 更新(1.0.0.20140629)以来,git-pull无需此PATH覆盖即可正常运行。

回答by basbebe

There is an update to git-rebase.sh

git-rebase.sh 有更新

https://github.com/git/git/pull/110/files

https://github.com/git/git/pull/110/files

回答by Frank L?mmer

UPDATE: still not working with release mentioned below, my mistake. Git push works Git pull doesn't.

更新:仍然无法使用下面提到的版本,我的错误。Git push 工作 Git pull 没有。

It seems to me that the issue has been fixed by Apple with Mac OS X Yosemite 10.10 (14A329r). i am on the general Beta Yosemite channel (not developer). Git push/pullworks as expected again without any modifications.

在我看来,Apple 已通过 Mac OS X Yosemite 10.10 ( 14A329r)解决了该问题。我在一般的 Beta Yosemite 频道(不是开发人员)。git推送/无需任何修改即可再次按预期工作。