Problem with authentication - Unable to push lfs and VScode popup

Working on a branch, I have been getting a really annoying popup for a few days

I just tried to push some new images which failed and I think the problems are connected.

git lfs status

On branch NLM
Git LFS objects to be pushed to origin/NLM:

        src/assets/images/innovation.png (dc8b795b8b5134890942933bb1812f8890535a6dcc15a056d69a4fdca1650ead)
        src/assets/images/integrity.png (76491b3b117507ecb6a7e554137e47a47ad3e257140f2c6e1211a0fcb934cc46)
        src/assets/images/loading.png (0a7335ace7c03ca2bafc7aed49c7aa403b7840efb7bd71e0820aa31b4b1c702c)

git lfs push

Specify a remote and a remote branch name (`git lfs push origin master`)

git lfs push origin NLM

Says it’s done it’s job but files remain staged.

remote origin = git@gitlab.com:x/x.git so using ssh. However, this hasn’t mattered before now.

Have already tried unlinking project and logging out

Following in config

[credential]
	helper = netlify
[lfs "https://xxx.netlify.app/.netlify/large-media"]
	access = basic
	locksverify = false

Deleted netlify credential helper and installed again. Still same problem.

Hi, @CraigC. My best guess is that VSCode is using a different version of Git or not using the same shell environment that the CLI version of Git is using.

In a terminal window and in the base directory of the repo, would you please send us the output of the following commands?

netlify lm:info
git config -l
GIT_TRACE=true GIT_CURL_VERBOSE=true git lfs push --all origin

The the last two commands above might output private information. If so, please feel free to redact those details or to private message (PM) the information instead of posting it publicly.

1 Like

Hi Luke,
Thanks, finally got round to having a look at this.
Have sent a PM

Hi, @CraigC. You sent me the output of running Git commands on the command line. However, the issue you are experiencing isn’t with Git on the command line. The issue you are experiencing is with VSCode.

I think VSCode is using its own built-in version of Git:

https://git-scm.com/book/en/v2/Appendix-A%3A-Git-in-Other-Environments-Git-in-Visual-Studio-Code

If this is so, I’m doubting it will use our credential helper. I believe you are going to find that VSCode and our Large Media feature are incompatible for this reason.

Do you have a way of debugging VSCode’s Git configuration? I ask because I have no experience doing that.

Now, if you find a way to get VSCode to use your local Git installation (and therefore to get it to be compatible with Large Media), please let us know. Similarly, if you have other questions we will be happy to answer.

[Edit]

I did read that wrong and it does leverage the local systems Git installation. However, what we need is to see the output of those commands as VSCode would run them. I’m guessing that the environment for VSCode is different that your personal environment and this is likely causing a difference when VSCode tries to do things (because it is missing the Git credential helper).

I’m still stuck as the β€œhow do we see what VSCode sees” step though. Do you have ideas about how to debug that?

Thanks Luke. For this I am minded to disable the git extension and have done with it. I’m working on the project less and less. I can upload new media via forestry so don’t really need to be able to add from my dev environment. Most images are user uploaded.

I think this was a mixture of a plugin and also a setting on the repo being reverted to allow Git LFS which needed to be disabled. I have no idea when or how this setting was reverted.

1 Like

Thanks for following up and sharing this, @CraigC ! This will be helpful should any other Forums members encounter something similar.

Good day.
I am experiencing the seemingly same issue as described above. Instead of opening a new topic, I thought i would revive this old thread.
I could not follow what the author described as his personal solution.

I think my git push is working, but vscode keeps prompting me to login to ****.netlify.app…

Here is some (obfuscated) infos:

──────────────────────┐
 Current Netlify User β”‚
β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Email: ..@...
────────────────────┐
 Netlify Site Info  β”‚
β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Current site: (...)
Netlify TOML: C:\P\(...)\netlify.toml
Admin URL:    https://app.netlify.com/sites/(...)
Site URL:     https://(...).netlify.app
Site Id:      28947762-(...)
netlify lm:info
  √ Checking Git version [2.37.1.windows.1]
  √ Checking Git LFS version [3.2.0]
  √ Checking Git LFS filters
  √ Checking Netlify's Git Credentials version [0.1.11]

git config -l

diff.astextplain.textconv=astextplain
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
http.sslbackend=schannel
core.autocrlf=true
core.fscache=true
core.symlinks=false
credential.helper=manager-core
pull.rebase=false
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master
user.name=(...)
user.email=(...)
core.editor="C:\Users\(...)\AppData\Local\Programs\Microsoft VS Code\bin\code" --wait
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=C:/Users/(...)/AppData/Roaming/netlify/Config/helper/git-config
credential.helper=
credential.helper=netlify
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.origin.url=https://github.com/(...)/(...).git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.main.remote=origin
branch.main.merge=refs/heads/main
lfs.repositoryformatversion=0
lfs.https://28947762-3aa5-4466-a49d-4ce2dd180e93.netlify.app/.netlify/large-media.access=basic
lfs.https://28947762-3aa5-4466-a49d-4ce2dd180e93.netlify.app/.netlify/large-media.locksverify=false

Git log from vscode

[2022-09-25T18:40:04.358Z] Log level: Info
[2022-09-25T18:40:04.361Z] [info] Validating found git in: C:/Program Files/Git/mingw64/libexec/git-core
[2022-09-25T18:40:04.367Z] [info] Validating found git in: C:\Program Files\Git\cmd\git.exe
[2022-09-25T18:40:04.441Z] [info] Using git 2.37.1.windows.1 from C:\Program Files\Git\cmd\git.exe

Do you have any tips?
Thanks

Hi, @djangal. It sounds to me like this specific issuesis occurring for VS Code:

Common issue: The Git Credential Helper isn’t installed for the shell

When you are using Git in the terminal, the Git credential helper is configured for that environment. My best guess is that isn’t true for the VS Code environment.

Based on the logging from VS Code, it looks like it is calling the Git CLI tool. If so, the same configuration which works for your local shell environment should also work for whatever environment is being used by Git when VS Code.

I don’t personally use VS Code (or Windows) but I found this documentation here:

That screenshot on that page above shows a Git setting for β€œCredential helper” in VS Code. I believe if you correctly set that to match the shell environment setting, the pushes will start working.

To summarize, if you configure VS Code to use the same Git Credential helper which exists in your terminal it will start working. If there are other questions about this, please let us know.

Thanks for the swift response.
The link you posted is for VS not for VSCode, which are completely different environments, unfortunately.
As far as I understand, VSCode would use the same git and credential helpers that I am using in the terminal.
If I remove the netlify credential helper from the gitconfig, the prompt in vscode changes from a terminal login prompt to a windows style dialog, which tells me, that vscode is just running a git-process, which in turn actually uses netlify credential helper, but something else is off?

:wave: @djangal

You mentioned that git push is working. I wanted to confirm if you were able to deploy successfully? Also, curious to know if you are using Identity or password protection on your site?