netlify / netlify-credential-helper

Git credential helper to use Netlify's API as authentication backend
MIT License
17 stars 4 forks source link

Git credential helper not working with environmental variable NETLIFY_AUTH_TOKEN #41

Open lookea opened 4 years ago

lookea commented 4 years ago

When using NETLIFY_AUTH_TOKEN

[06:51:39] Checking Git version [started] 
[06:51:39] Checking Git version [2.24.1] [title changed] 
[06:51:39] Checking Git version [2.24.1] [completed] 
[06:51:39] Checking Git LFS version [started] 
[06:51:39] Checking Git LFS version [2.9.2] [title changed] 
[06:51:39] Checking Git LFS version [2.9.2] [completed] 
[06:51:39] Checking Git LFS filters [started] 
[06:51:39] Checking Git LFS filters [completed] 
[06:51:39] Installing Netlify's Git Credential Helper for Linux [started] 
[06:51:39] Installing Netlify's Git Credential Helper for Linux [completed] 
[06:51:39] Configuring Git to use Netlify's Git Credential Helper [started] 
[06:51:39] Configuring Git to use Netlify's Git Credential Helper [completed] 

   ┌───────────────────────────────────────────────────────────────────────┐ 
   │                                                                       │ 
   │   Run this command to use Netlify Large Media in your current shell   │ 
   │                                                                       │ 
   │              source /root/.netlify/helper/path.bash.inc               │ 
   │                                                                       │ 
   └───────────────────────────────────────────────────────────────────────┘ 

Already logged in via process.env.NETLIFY_AUTH_TOKEN set in your terminal session 

Run netlify status for account details 

To see all available commands run: netlify help 

fetch: Fetching reference HEAD 
panic: runtime error: slice bounds out of range 

goroutine 1 [running]: 
github.com/netlify/netlify-credential-helper/credentials.getCredentials(0xb68140, 0xc00000c010, 0xb68180, 0xc00000c018, 0xc000583e38, 0xc0004969c0) 
    /home/david/src/github.com/netlify/netlify-credential-helper/credentials/credentials.go:126 +0xd36 
github.com/netlify/netlify-credential-helper/credentials.handleCommand(0x7fffbe09b6ab, 0x3, 0xb68140, 0xc00000c010, 0xb68180, 0xc00000c018, 0x8, 0xa5c880) 
    /home/david/src/github.com/netlify/netlify-credential-helper/credentials/credentials.go:65 +0x127 
github.com/netlify/netlify-credential-helper/credentials.HandleCommand() 
    /home/david/src/github.com/netlify/netlify-credential-helper/credentials/credentials.go:52 +0x2db 
main.main() 
    /home/david/src/github.com/netlify/netlify-credential-helper/cmd/netlify-credential-helper/main.go:6 +0x20 
fatal: could not read Username for 'https://f7251970-8b64-4bb1-a9d6-2ceda146a2b1.netlify.com/.netlify/large-media': No such device or address 
batch response: Git credentials for https://f7251970-8b64-4bb1-a9d6-2ceda146a2b1.netlify.com/.netlify/large-media not found. 
error: failed to fetch some objects from 'https://f7251970-8b64-4bb1-a9d6-2ceda146a2b1.netlify.com/.netlify/large-media' 

The following happens when I run lm:setup that do auth without the env variable

Logging into your Netlify account... 
Opening https://app.netlify.com/authorize?response_type=ticket&ticket=791b275986e24789b47fd92430f26721 
--------------------------- 
Error: Unable to open browser automatically 

Please open your browser & open the URL below to login: 
https://app.netlify.com/authorize?response_type=ticket&ticket=791b275986e24789b47fd92430f26721 
--------------------------- 

You are now logged into your Netlify account! 

Run netlify status for account details 

To see all available commands run: netlify help 

[06:58:05] Provisioning Netlify Large Media [started] 
[06:58:05] Provisioning Netlify Large Media [completed] 
[06:58:05] Configuring Git LFS for this site [started] 
[06:58:05] Configuring Git LFS for this site [completed] 
fetch: Fetching reference HEAD 
aero31aero commented 2 years ago

Bumping as this issue is still relevant on:

netlify lm:info
  ✔ Checking Git version [2.25.1]
  ✔ Checking Git LFS version [2.9.2]
  ✔ Checking Git LFS filters
  ✔ Checking Netlify's Git Credentials version [0.1.10]

The error shows up as:

git lfs pull
panic: runtime error: slice bounds out of range [:6] with length 0                                                                                                                                                                         

goroutine 1 [running]:
github.com/netlify/netlify-credential-helper/credentials.getCredentials(0xbb2980, 0xc00000e018, 0xbb29c0, 0xc00000e020, 0xc000228460, 0xb2aa68)
        /*****/netlify-credential-helper/credentials/credentials.go:127 +0xd1e
github.com/netlify/netlify-credential-helper/credentials.handleCommand(0x7ffca984556f, 0x3, 0xbb2980, 0xc00000e018, 0xbb29c0, 0xc00000e020, 0xa93a20, 0xb9ce04)
        /*****/netlify-credential-helper/credentials/credentials.go:66 +0x7c
github.com/netlify/netlify-credential-helper/credentials.HandleCommand()
        /*****//netlify-credential-helper/credentials/credentials.go:53 +0x32c
main.main()
        /*****//netlify-credential-helper/cmd/netlify-credential-helper/main.go:6 +0x25
Username for 'https://febcb71f-a965-4a07-998b-a6962e4400ae.netlify.app':

This is a deal breaker for cloning on remote servers; the workaround is to copy your local config.json to that remove server via scp etc, and is arguably not sustainable.

funkeyfreak commented 2 years ago

Echoing this sentiment. I have encountered this error, and it has removed the viability of LMS for my team.

LukasGentele commented 1 year ago

Still no fix for this?