This scirpt is git subcommand credential-bitwarden
which manages git credential using Bitwarden CLI.
I personally use Bitwarden to manage my credentials. So I'd like to store GitHub access key using Bitwarden on my Linux PC.
For macOS, there is an embedded integration credential-osxkeychain
in Git command but it doesn't work on Linux.
The command is called by git bommand if needed.
To use the integration, you have to configure valid BW_SESSION
environment variable.
The BW_SESSION
value can be obtained/configured by the following commands.
$ bw login
$ bw unlock
...
$ export BW_SESSION="....."
- Python 3 (Tested by Python 3.7)
- Bitwarden CLI (https://github.com/bitwarden/cli)
- Valid BW_SESSION environment valiable
If you don't have proper directory to install, the following commands will work.
$ mkdir ${HOME}/bin
$ export ${HOME}/bin:${PATH} >> ${HOME}/.bashrc
$ source .bashrc
Download the file git-credential-bitwarden
.
$ curl -o ${HOME}/bin/git-credential-bitwarden https://raw.githubusercontent.com/superdaigo/git-credential-bitwarden/master/git-credential-bitwarden
$ chmod +x ${HOME}/bin/git-credential-bitwarden
$ git config --global credential.helper bitwarden
$ rm ${HOME}/bin/git-credential-bitwarden
$ git config --global --unset credential.helper
You might be able to remove ${HOME}/bin
directory and PATH
configuration from your ${HOME}/.bashrc
file.
- Need to unlock and reregister
BW_SESSION
after the expiration. - The command is slow.