Context
Assuming that:
- I have a repository on GitLab and I have already cloned it on my machine.
- I have a GitLab token allowing me to push from and pull to this repository.
- This token is already saved into my Bitwarden vault.
- Thanks to the Bitwarden CLI, I can authenticate/lock/unlock my vault programmatically.
Question
Is there a way to programmatically chain/pipe the GitLab token fetched on the fly by Bitwarden to the git push and pull commands in order to authenticate/authorize these operations?
Investigations
I heard about the following solutions to workaround the issue but they do not comply with the security rules I need to face: I can't store any secret in plain text on disk.
- The GitLab token can be put in git credentials helper.store file. Here the GitLab token needs to be stored in plain text in the store file.
- The git remote URLs can be modified to include the credentials in them. Here the GitLab token needs to be stored in plain text in git remote URLs.
Notes
- I can't use SSH keys, I need to stay on the HTTPS protocol.
- The git version I target is the one proposed from official Ubuntu packages (
2.17.1at the time of writing).