1

I'm struggling to get git to remember my username/password when doing a git push to a gitlab repo (I'm assuming the same problem would happen with a Github repo). It's driving me batty to have type in my username/password every time.

When I do git config --global credential.helper osxkeychain it accepts it with no problems.

But when I do an actual git push I get --> git: 'credential-osxkeychain' is not a git command. See 'git --help'.

I have a conda environment activated so I can use python 3.6 because of a package compatibility issue. When I do conda list I see git listed. However when I do a conda search for osxkeychain I get no results. I installed xcode via xcode-select --install

If I deactivate the conda environment then it works like a charm and must have the password stashed from previously as it doesn't even ask me for any credentials. Just pushes like it knows what it's doing.

DChaps
  • 482
  • 5
  • 12

1 Answers1

2

I can confirm this behavior. It seems like the Anaconda build of git does not compile the osxkeychain credential module. Fortunately, the Conda Forge one does, so I'd say the simplest solution is likely

conda install conda-forge::git

Once installed, rerun the configuration command

git config --global credential.helper osxkeychain
merv
  • 67,214
  • 13
  • 180
  • 245
  • I did need to rerun the credential.helper line but otherwise it went smoothly. Can you explain the **conda-forge::git** a bit? Obviously, it installed git from there but how does that work in context of conda, who is conda-forge, and what does ```::``` do? – DChaps Oct 16 '19 at 04:36
  • @DChaps [Conda Forge](https://conda-forge.org/) is an open channel for Conda packages. Typically, if something isn't available on Anaconda channels there's a good chance it might be on Conda Forge. All the Conda Forge build recipes are in open feedstocks on GitHub, and can be freely improved upon via pull requests. As for the `::`, most Conda commands use [MatchSpec notation](https://stackoverflow.com/a/57734390/570918), which in this case is `channel::package`. This could be equivalently done with `conda install -c conda-forge git`. – merv Oct 16 '19 at 16:13
  • @DChaps FYI this should now be fixed [in the Anaconda version of git](https://github.com/AnacondaRecipes/git-feedstock/commit/e1d9304ea2c642385f793f782b7f5f647f02ab08). I haven't tested it though. – merv Oct 27 '19 at 16:08
  • I looked for hours and finally this solved my problem. Holy! Thanks. – k-war Aug 03 '21 at 21:57
  • @k-war were you installing an old version from the `defaults` channel? The newer builds on both `defaults` and `conda-forge` should include the `osxkeychain` module. – merv Aug 04 '21 at 23:55
  • @merv No. I was building a specific conda environment from an environment.yml file which had: channels: - conda-forge - defaults yet somehow was giving me this error. – k-war Aug 05 '21 at 00:45