0

Why, on my OSX 10.8.5 system, does git (version 1.8.5.2/Apple Git-48) allow me to access https://github.com/... URLs without challenging me for username/password, even though a credential.helper is not in my git configuration?

While it's true that my github.com username/password are in my OSX keychain, running
git config -l shows only the following:

difftool.kdiff3.path=/Applications/kdiff3.app/Contents/MacOS/kdiff3
difftool.kdiff3.trustexitcode=false
difftool.prompt=false
diff.tool=kdiff3
mergetool.kdiff3.path=/Applications/kdiff3.app/Contents/MacOS/kdiff3
mergetool.kdiff3.trustexitcode=false
mergetool.keepbackup=false
merge.tool=kdiff3

i.e., no credential.helper configured.

Yet I was able to clone a private repo (not owned by me, though my GitHub account has been made a member of the organization that owns it) using its https address, unaltered from how it appears on its GitHub page:

% git clone https://github.com/organization/project.git

i.e., no username or password interpolated into the URL.

I reviewed the other answers to this question as well, but none of them seem to apply to my situation, e.g., I don't have a .netrc file, I'm not using ssh, I`m not using GitHub auth tokens, etc.

I've seen other people waste lots of hours trying to figure out why git is either doing something they don't want, or not doing something that they do want. It usually comes down to git having too many obscure and partially-overlapping options that are impossible for most mortals to keep straight in their heads, or remember that they've enabled at some time in the past.

I suspect that I've either fallen into that kind of trap, or that there is some kind of OSX-specific magick going on under the covers that I'm not aware of -- like, I dunno, maybe Apple decided to be "helpful" and build keychain access into "Apple Git-48" without requiring the user to set up a credential helper.

(BTW, I considered asking this in the AskDifferent SE, but decided to ask it here instead, since I figured there are probably more git power-users who happen to use OSX than there are OSX power-users who happen to use git.)

Community
  • 1
  • 1
Hephaestus
  • 1,982
  • 3
  • 27
  • 35
  • Apple's version of git is part of Xcode, which uses keychain to store credentials for git servers, so it's reasonable (IMO) to assume that's exactly what has happened here. Try this: `strings /Applications/Xcode.app/Contents/Developer/usr/bin/git | grep -i keychain` – Dan Lowe Nov 30 '15 at 19:40
  • Yep, that command returns a single line that reads `osxkeychain`. I've never used XCode, as such, directly on this machine. I only installed it because something *else* that I wanted to install needed it to build. And that was before I had a need to do anything with git. Maybe if I had installed git some other way (Homebrew?) I might not have gotten this behavior. Thanks for connecting the dots for me. – Hephaestus Nov 30 '15 at 20:06
  • You can just install git in homebrew alongside the Xcode version. As long as `/usr/local/bin` is before `/usr/bin` in your `$PATH`, it will be used. (That's what I do.) – Dan Lowe Nov 30 '15 at 20:31

0 Answers0