Git-push requires netlify credentials

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.

I setup my repo for Large Media and now I can’t push anymore. When I try I get this message
git: ‘credential-netlify’ is not a git command. See ‘git --help’.
Username for ‘https://5bcbd123-6756-4775-9db2-da74181bb0a1.netlify.app’:
Password for ‘https://5bcbd123-6756-4775-9db2-da74181bb0a1.netlify.app’:
But I created my Netlify account through my GitHub account so I don’t have username or password other than my regular GitHub credentials. Not sure how to move forward?

When you install the Large Media add-on for a site at Netlify, it moves the Git LFS service from your Git service (GitHub, GitLab, Bitbucket) to Netlify. This means that any git push requires Netlify credentials as well.

The Netlify credentials are normally provided by the Netlify Git credential helper. Your local shell environment must load this credential helper and it sounds like that isn’t happening.

The output of the three commands below will tell us more. Would you please attach the output of these three commands here?

netlify lm:info
git config -l
echo $0

For example, this is the output for me:

$ netlify lm:info
  ✔ Checking Git version [2.28.0]
  ✔ Checking Git LFS version [2.12.0]
  ✔ Checking Git LFS filters
  ✔ Checking Netlify's Git Credentials version [0.1.9]
$ git config -l
credential.helper=osxkeychain
user.name=Luke F. Lawson
user.email=luke@netlify.com
core.editor=nano
push.default=simple
include.path=/Users/luke/.netlify/helper/git-config
credential.helper=
credential.helper=netlify
credential.helper=osxkeychain
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
pull.rebase=false
$ echo $0
-bash

Skipping ahead to the solution, this normally involves adding a line to .bash_profile or similar to make sure the credential helper is being loaded in the shell environment. However, before I can tell you what line to add, I need to know if it is installed and what shell is being used for your local system. The output of the commands above will help me to answer.

​Please let us know if there are any questions for us.

Hi Luke, thanks for coming back to me. I figured it out. Have a nice day!

Please what was your solution?! I’m stuck here :slight_smile:

This is such a problem I might have to be done with netlify.

Hi @AustinRhoads,

The thread above is already pretty detailed with a lot of problems and use cases. Have you read the possible solutions?

If none works, could you explain what problem you’re facing and what you’ve already tried so we don’t suggest the same thing again to you?

I’m on Ubuntu20.04 and I can’t find .netlify under ~, I’ve installed netlify-cli successfully and can run command in terminal without problem.