Glab auth git-credential: "erase" is an invalid operation

Hi!

I had an issue in the past with Gitlab CLI auth a community member helped me out with in this question. I worked for a while with it until the CLI complained with this output:

Glab auth git-credential: "erase" is an invalid operation..         

remote: HTTP Basic: Access denied. If a password was provided for Git authentication, the password was incorrect or you're required to use a token instead of a password. If a token was provided, it was either incorrect, expired, or improperly scoped. See https://gitlab.com/help/topics/git/troubleshooting_git.md#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://gitlab.com/wavesinaroom/waves_nixconfig.git/'

My nix expression is:

{ lib, pkgs, ... }: {
  programs.git = {
    enable = true;
    settings = {
      user.name = "wavesinaroom";
      user.email = "wavesinaroom@posteo.com";
      init.defaultBranch = "main";
      credential."https://gitlab.com".helper =
        "!${lib.getExe pkgs.glab} auth git-credential";
      merge.strategy = "rebase";
      pull.rebase = true;
    };
  };
  programs.lazygit.enable = true;
}

I already switched my configuration without any problem. However, I don’t know how my glab credentials are stored with this expression or how the credential helper works in this case. Why am I blaming nix? Well, each time I start working on my computer I solved this issue with a login in the CLI so I think that somehow nix loses the credential. Again I don’t know how.

Can anyone lend me a hand with shedding some light into this please?

Alright, for those who come across with this issue in the future although unlikely, this is a glab bug reported here. I had to deal with it because I’m using NixOS with WSL so there are old packages that aren’t updated. Fixing this is quite simple, just get the latest version of nixpkgs and update