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

GitZshOsx Yosemite

Git Problem Overview


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

> /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.

Other git commands are working exactly as expected

Git Solutions


Solution 1 - Git

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

/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.

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:

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)

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.

Solution 2 - Git

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.

Solution 3 - Git

Downloading the newest version of iTerm2 fixed this for me!

Solution 4 - Git

Another solution, modify your 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!

Solution 5 - Git

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

. /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.

Solution 6 - Git

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:

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 git with appropriate absolute links. You can use the following Gists to do the same:

  • 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

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...

Solution 7 - Git

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 *:

. /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/.

Solution 8 - Git

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

PATH="$(dirname $0):$PATH"

Or just copy paste this in your terminal :

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

Update: As presumed by pilif, since last iTerm2 update (1.0.0.20140629), git-pull run properly without this PATH override.

Solution 9 - Git

There is an update to git-rebase.sh

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

Solution 10 - Git

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

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/pull works as expected again without any modifications.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmeghaphoneView Question on Stackoverflow
Solution 1 - GitpilifView Answer on Stackoverflow
Solution 2 - GitJeremy Huddleston SequoiaView Answer on Stackoverflow
Solution 3 - GitMarthyn OlthofView Answer on Stackoverflow
Solution 4 - GitFengView Answer on Stackoverflow
Solution 5 - GitUbiquillView Answer on Stackoverflow
Solution 6 - GitjbnunnView Answer on Stackoverflow
Solution 7 - GitferchakView Answer on Stackoverflow
Solution 8 - GitpyrouView Answer on Stackoverflow
Solution 9 - GitbasbebeView Answer on Stackoverflow
Solution 10 - GitFrank LämmerView Answer on Stackoverflow