Issue cloning GitHub repo that has Netlify LFS setup

What I’m doing:

I’m trying to clone a GitHub repo that backs my Netlify site. The GitHub repo refers to files stored in Netlify LFS. (I am planning to migrate away since I heard it was deprecated, but step one is getting it cloned locally…)

I’m using an Ubuntu 22.04 LTS machine to do the cloning. I have the netlify CLI installed and the proper plugin installed as per the instructions: Large Media setup | Netlify Docs

What is happening:

When I try to clone, I’m getting prompted for a username/password combo. It appears to be coming from the netlify-credential-helper.

Cloning into '$REPO_NAME'...
remote: Enumerating objects: 2946, done.
remote: Counting objects: 100% (61/61), done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 2946 (delta 39), reused 28 (delta 28), pack-reused 2885
Receiving objects: 100% (2946/2946), 6.30 MiB | 7.99 MiB/s, done.
Resolving deltas: 100% (275/275), done.
panic: runtime error: slice bounds out of range [:6] with length 0

goroutine 1 [running]:{0x9cc1e0, 0xc0000b8000}, {0x9cc200, 0xc0000b8008})
        /Users/erezrokah/Code/github/netlify/netlify-credential-helper/credentials/credentials.go:127 +0x9d0{0x7ffd86c88500, 0xc0008dde10}, {0x9cc1e0, 0xc0000b8000}, {0x9cc200, 0xc0000b8008})
        /Users/erezrokah/Code/github/netlify/netlify-credential-helper/credentials/credentials.go:66 +0x5d
        /Users/erezrokah/Code/github/netlify/netlify-credential-helper/credentials/credentials.go:53 +0x1e6
        /Users/erezrokah/Code/github/netlify/netlify-credential-helper/cmd/netlify-credential-helper/main.go:6 +0x17
Username for '':

Things I’ve tried:

I ran through the troubleshooting steps here:

Diagnostic info:

> netlify --version
netlify-cli/17.14.0 linux-x64 node-v20.11.0

> netlify login
Already logged in via process.env.NETLIFY_AUTH_TOKEN set in your terminal session
Run netlify status for account details
or run netlify switch to switch accounts
To see all available commands run: netlify help

> netlify lm:info
✔ Checking Git version [2.37.3]
✔ Checking Git LFS version [3.0.2]
✔ Checking Git LFS filters
✔ Checking Netlify's Git Credentials version [0.1.11]
  • I’ve tried netlify logout and netlify login - this doesn’t seem to change anything
  • I’ve tried manually sourcing the zsh include in my shell (but it’s already sourced in .zshrc)
  • I’ve tried updating to the latest node.js and reinstalling the netlify cli
  • I’ve tried deleting ~/.config/netlify and reinstalling the CLI and netlify lm:install

Any help is appreciated :slight_smile:

Of course, after I went through the trouble of writing all this down, I find this:

The netlify-credential-helper has a known issue that is several years old - it can’t use an API token defined in the environment.

What I had to do was spin up a VNC session on my Ubuntu box, install Firefox, and do netlify login at the terminal without NETLIFY_AUTH_TOKEN set. That opened a login page in Firefox.

The first time I logged in, it redirected me to the normal Netlify control panel interface, and the netlify login command timed out. I ran netlify login again, and since Firefox was already logged into Netlify, I instead got an OAuth prompt page. Accepting this prompt caused netlify login to succeed.

Afterwards, I’m able to clone the repo properly.

Sorry for the hassle, but I’m glad you were able to find a solution and could share this with the community. This will help other folks who stumble upon this thread.