git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Mac OS Git non-interactive shell problem

From
SPShannon Pekary <spekary@gmail.com>
Date
May 21, 2016, 15:05 UTC
Message-ID
<91B3CC94-4955-4AAB-B461-E6F5C5D9F682@gmail.com>
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 spekary@gmail.com

Message 1 of 1 in “Mac OS Git non-interactive shell problem”
  1. Shannon PekaryMay 21, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.