gitgit-credential-manager

Using different credentials for alternating repos with Microsoft Git-Credential-Manager


I'm using Microsoft Git-Credential-Manager for Linux (Ubuntu) for a couple weeks, with some credentials, and now I need to push modifications to a different repo with different credentials. But I can't do this, because GCM is trying to use incorrect data to access this repository.

How do I change these or add new ones in order to be able to commit to different repos with different credentials? Is it possible?


Solution

  • You can use git credential manager command to delete the entry for a given remote host.

    git credential-manager reject <url>
    

    Once the entry is deleted, you would be able to store new credentials.

    You can store (git credential-manager store) one credential per host and user: that will be valid for all repos owned by said user.

    For a credential per repository, as seen in Git-Credential-Manager-for-Windows/issue 749, use (for Windows or Linux) the git config credential.useHttpPath, explained in git credentials.

     git config --global credential.useHttpPath true