glab auth git-credential: "erase" is an invalid operation.
Checklist
-
I'm using the latest version of the extension (Run glab --version) 1.46.1 -
Operating system and version: Darwin XXXX 24.0.0 Darwin Kernel Version 24.0.0 -
Gitlab.com or self-managed instance? self-managed instance -
GitLab version (if self-managed) 17.3.x -
I have performed glab auth statusto check for authentication issues
Summary
- I use glab as git credential helper.
[credential "https://git.example.com"]
username = myuser
helper = /opt/homebrew/bin/glab auth git-credential
- This works fine when the access token is still valid.
- However, after it expires, I get the following message:
❯ git push
glab auth git-credential: "erase" is an invalid operation.
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://git.example.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://git.example.com/group/project.git/'
- After running
glab auth statusthe access token is refreshed and pushing succeeds.
Environment
- OS: Darwin 24.0.0 arm64
- SHELL: /bin/zsh
- TERM: xterm-256color
- GLAB: Current glab version: 1.46.1 (2024-09-10)
- GITLAB_HOST: https://git.example.com
Steps to reproduce
- Configure glab as credential helper.
- Login and use oauth 2.
- Check out an internal or private repository using https.
- Look into
~/.config/glab-cli/config.ymland wait for access token to expire. - Try to run
git pullorgit push.
What is the current bug behavior?
I get an error message:
❯ git push
glab auth git-credential: "erase" is an invalid operation.
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://git.example.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://git.example.com/group/project.git/'
What is the expected correct behavior?
glab automatically tries to refresh the access-token with its refresh_token.
Edited by Mirko Friedenhagen