Quantcast

Mac OS Git non-interactive shell problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Mac OS Git non-interactive shell problem

Shannon Pekary
I recently had a problem with SmartGIt that I think is related to the Mac version of the Git install, or perhaps git itself. Its hard for me to tell. Here is the recreation steps:

- Install a clean El Capitan
- Install the latest SmartGit
- Install the latest Mac OS Git from the Git website
- enable the keychain credential helper (perhaps as a global git option)
- Set the SmartGit preference to point to the newly installed git in /usr/local/bin such that it specifically starts that git.
- Try to push to a github repo that uses a keychain credential

Result: Multiple error messages that osxkeychain-credential is not a git command.

Running git from the command line in Terminal works fine.

The problem is that when SmartGit tries invokes git, it does it from a non-interactive shell, and in this mode, all the usual .profile and .bash_profile files are not sourced. I do not know where or if the MacOS git installer is trying to put /usr/local/bin into the path, but its not in the default path in non-interactive mode. Thus, git, when invoked in non-interactive mode cannot find the credential-helper, since El Capitain seems to come with version 2.7 by default, and that does not have a credential helper.

It was driving me crazy, because git worked perfectly fine from Terminal. The reason being, bash was reading my local .bash_profile where I was putting /usr/local/bin in the path.

So, the fix. Not so easy perhaps. Should the Git Mac OS installer put /usr/local/bin in the path for all invocations of shells? Probably OK if it is last in line. It certainly isn’t there by default. Or can git itself be changed to look for a credential helper in the same location as where git was invoked, if git is not in the path (in other words, if git is specifically invoked with a path, like /usr/local/bin/git, should it not also look for the credential helper in the same place, even if /usr/local/bin is not in the PATH environment variable?).

Shannon Pekary
[hidden email]



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Loading...