Git-push requires netlify credentials

I created a .zshenv file and added that line and even re-cloned my repository from scratch and followed this to cach my credentials but git is still asking for my username and password.

Hi, @rodrigoalcarazdelaos, would you please send us the three following details?

If so, the output of the three commands below would be helpful:

echo $PATH
netlify lm:info
netlify status

Output of echo $PATH:

/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/rodrigoalcarazdelaosa/.netlify/helper/bin

Output of netlify lm:info:

Output of netlify status:

Just in case this sheds light on the matter, I just noticed an issue when trying to clone my repo from Github Desktop, something that doesn’t happen with the git clone command from the Terminal. It surely has to do with Git LFS, and perhaps with Netlify Large Media too

1 Like

Hi, @rodrigoalcarazdelaos, I’m stumped and I’ve asked our developers to take a look and assist with the troubleshooting here.

Someone will be following up here shortly. (Either our developers will reply directly or I will pass on their suggestions.)

We will have another reply here soon!

1 Like

I’m still making best guesses here and I don’t know why this is happening for your system. One thing that sticks out is the Git version: Git-128) (with a closing parenthesis).

This is what I get locally:

$ netlify lm:info
  ✔ Checking Git version [2.26.2]
  ✔ Checking Git LFS version [2.10.0]
  ✔ Checking Git LFS filters
  ✔ Checking Netlify's Git Credentials version [0.1.9]

I believe version “Git-128” is the stock Git client installed with MacOS (or maybe with Xcode). This might not be the same Git that the git credential helper is designed for and I don’t know if that version is supported or not. (I’m having trouble getting more information about what git version that actually is as it doesn’t match the versioning system for Git):

So this might just come down to an unsupported Git client version. You can see the path to git with which and then check that version directly with the fully-qualified path name (FQPN):

$ which git
/usr/local/bin/git
$ /usr/local/bin/git version
git version 2.26.2

You can also look around for other versions of git installed:

$ find / -type f -iname "git"  2>/dev/null
/usr/bin/git
/usr/local/Homebrew/Library/Homebrew/shims/scm/git
/usr/local/Cellar/git/2.26.2/bin/git
/usr/local/Cellar/git/2.26.2/share/git-core/contrib/mw-to-git/bin-wrapper/git
/Library/Developer/CommandLineTools/usr/bin/git
/System/Volumes/Data/usr/local/Homebrew/Library/Homebrew/shims/scm/git
/System/Volumes/Data/usr/local/Cellar/git/2.26.2/bin/git
/System/Volumes/Data/usr/local/Cellar/git/2.26.2/share/git-core/contrib/mw-to-git/bin-wrapper/git
/System/Volumes/Data/Library/Developer/CommandLineTools/usr/bin/git

I think I proved the Apple version hypothesis:

$ /usr/bin/git version
git version 2.24.1 (Apple Git-126)

Above is Git-126) (closing parenthesis and all) similar to the Git-128) on your system.

So, just changing the PATH environment variable to use the Homebrew version of git might resolve this:

If that doesn’t work, please let us know.

I can confirm that Apple Git-128 corresponds to git version 2.24.3.

I installed the Homebrew version of git using brew install git and now I have git version 2.28.0 (I didn’t need to change any environment variable).

netlify lm:info
  ✔ Checking Git version [2.28.0]
  ✔ Checking Git LFS version [2.11.0]
  ✔ Checking Git LFS filters
  ✔ Checking Netlify's Git Credentials version [0.1.9]

I’m afraid, however, that the problem persists even after this and following this once again just in case (this worked before enabling Netlify LM).

Thanks again for your time!

I’m pretty sure it has to do with the fact that Netlify Git’s credential helper is not playing well with osxkeychain helper. I just posted a comment in this somehow similar issue.

Running git config -l I see this:

credential.helper=osxkeychain
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
user.name=rodrigoalcarazdelaosa
user.email=rodri.alcaraz@gmail.com
git-tmbundle.gitnub-path=https://github.com/rodrigoalcarazdelaosa
credential.helper=osxkeychain
include.path=/Users/rodrigoalcarazdelaosa/.netlify/helper/git-config
credential.helper=
credential.helper=netlify
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=https://github.com/rodrigoalcarazdelaosa/rodrigoalcarazdelaosa.me.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
lfs.https://084c644c-1539-4d00-93bc-dc75f576de30.netlify.app/.netlify/large-media.access=basic
lfs.https://084c644c-1539-4d00-93bc-dc75f576de30.netlify.app/.netlify/large-media.locksverify=false

So maybe with these two lines:

credential.helper=
credential.helper=netlify

Netlify’s Git credential helper is resetting all credential helpers and overriding osxkeychain

Hi, @rodrigoalcarazdelaos, I think you might have “cracked the case” by providing the information above.

First, would you please check the contents of this file:

  • /Users/rodrigoalcarazdelaosa/.netlify/helper/git-config

For example, this is what I see on my local system:

# The first line resets the list of helpers so we can check Netlify's first.
[credential]
  helper = ""

[credential]
  helper = netlify
  helper = osxkeychain

This results in the following with git config -l:

user.name=Luke Lawson
user.email=luke@netlify.com
core.editor=nano
push.default=simple
include.path=/Users/luke/.netlify/helper/git-config
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
include.path=/Users/luke/.netlify/helper/git-config
credential.helper=
credential.helper=netlify
credential.helper=osxkeychain

It is the three lines at the end and that specific ordering which is required for this to work:

credential.helper=
credential.helper=netlify
credential.helper=osxkeychain

For your git config -l output I see this instead:

credential.helper=
credential.helper=netlify

There is a credential.helper=osxkeychain line above the two lines above. However, the credential.helper=osxkeychain line should be just below the two lines above.

Just to clarify, we’re looking for the git config -l output to contain this:

credential.helper=
credential.helper=netlify
credential.helper=osxkeychain

and for there to be no more credential.helper lines after this.

Would you please confirm the contents of ~/.netlify/helper/git-config match the output I have included above? If not, please update that file. After it is updated, then open a new terminal window and see if the git config -l output has updated accordingly as well.

If it did update, try a git push with the Large Media site/app and it should work. It if didn’t update, please let us know and we’ll keep troubleshooting until it does.

2 Likes

That’s right @luke, my .netlify/helper/git-config file looked like:

# The first line resets the list of helpers so we can check Netlify's first.
[credential]
  helper = ""

[credential]
  helper = netlify

I added the line helper = osxkeychain and now git push from my Terminal is working fine (without asking for my credentials) but I’m still having trouble getting it to work from Textmate. Specifically I’m getting this error:

I’m pretty sure it has to do with the fact that git config -l now shows:

credential.helper=osxkeychain
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
user.name=rodrigoalcarazdelaosa
user.email=rodri.alcaraz@gmail.com
git-tmbundle.gitnub-path=https://github.com/rodrigoalcarazdelaosa
credential.helper=osxkeychain
include.path=/Users/rodrigoalcarazdelaosa/.netlify/helper/git-config
credential.helper=
credential.helper=netlify
credential.helper=osxkeychain
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=https://github.com/rodrigoalcarazdelaosa/rodrigoalcarazdelaosa.me.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
lfs.https://084c644c-1539-4d00-93bc-dc75f576de30.netlify.app/.netlify/large-media.access=basic
lfs.https://084c644c-1539-4d00-93bc-dc75f576de30.netlify.app/.netlify/large-media.locksverify=false

Indeed after including the contents of .netlify/helper/git-config I have the three lines:

credential.helper=
credential.helper=netlify
credential.helper=osxkeychain

but after the line:

git-tmbundle.gitnub-path=https://github.com/rodrigoalcarazdelaosa

I only have credential.helper=osxkeychain, and not credential.helper=netlify.
I’ll see what I can do.
Thanks!

This has been reported here.

Hi, @rodrigoalcarazdelaos. It does sound like the Git config for Textmate doesn’t match that of the terminal. However, I’m not sure what would be required to get Textmate to use the same configuration.

I personally strongly support GPL licensed software (like Textmate) so I would love to see a solution found. If you do get it working, it would be great to see the solution posted here.

1 Like

As per this comment, we have to set the PATH variable in TextMate → Preferences → Variables so that it matches our terminal. All I did was echo $PATH in my Terminal and copy that in TextMate. Now everything is working back again :partying_face:

Thank you, @rodrigoalcarazdelaos. I appreciate you following up to share the solution you found and I hope that people searching here in the future do as well.

Much appreciated! :+1:

1 Like

It was the least I could do after all the help received here :wink:.

3 Likes

I did actually end up landing on a solution similar to what you have described. I realized documentation was not written for ZSH and found that using the updated helper path was (one part of) my solution

1 Like

I do have to say, I have been dealing with this for weeks now and through it all, starting to learn more about the gitconfig settings, but not enough to communicate it to someone else. It has made it really hard to onboard other developers on to our project, so a lot of blocked energy at the moment…

So where this is breaking for us is when we need to work on a separate projects/repos. From what I can tell, Netlify is completely wiping out all of the other credentials and then applying it’s own. And I think it is doing it at the global level (am I right?).

Is it possible to make this happen at the local, project level?

I appreciate all of the comments and guidance in this thread. Happy to share more details about what issues we’re facing.

OK, I think I got it working. I learned that there are global, system, and local configuration files for git

Then I moved all of the netlify and LFS settings that were in the global config, and moved them to the local config in my project folder.

# The first line resets the list of helpers so we can check Netlify's first.
[credential]
  helper = ""

[credential]
  helper = netlify
  helper = store --file /path/to/local/private/git_credential_store

Also, since my global user.email is different than the one I use for Netlify and this project, I moved that into the local config as well

[user]
	email = jeremyzilar@gmail.com
	name = Jeremy Zilar

Lastly, I set the URL to use https for the site. This is so that it doesn’t conflict with this setting in my global config.

[url "https://github.com/brooklynrail/"]
	insteadOf = git@github.com:brooklynrail/
	insteadOf = ssh://git@github.com/brooklynrail/

In addition to this thread, these links were helpful in learning about the .gitconfig file

I am pretty sure this unblocks me, and that I can help others get set up with the project locally (though not without some 1:1 hand-holding.

Things I hope to explore:

  • Why GitHub Desktop doesn’t work with LFS
  • Can I set this project up in Docker (complete with LFS) in a way that it doesn’t interfere with other repos and/or local settings?

Hi, @jeremyzilar, thanks for the follow-up to share the solution and what you learned while troubleshooting. This is quite the deep dive and the resources you linked to are informative as well.

For those last two questions, I don’t know why GitHub Desktop isn’t working but I suspect the tool doesn’t support third-party Git LFS services (where the Git repo is at GitHub but the Git LFS service is at Netlify). I don’t know this for certain but I’ve seen that with other Git tools other than the Git CLI tool itself.

For the second question, I’ll don’t have any answers but if you find them we would love to hear about it here.