@kyanny's blog

My thoughts, my life. Views/opinions are my own.

Git リポジトリと通信する際にどの認証情報を使っているか確認する

git credential fill コマンドで確認できる。

git config - List git credentials from credential helper - Stack Overflow

git credential fill を実行すると入力待ちになるので、以下の二行を入力して、さらに空行を入力する(値は適切なものに変えること)。

protocol=https
host=github.com

空行を認識しない端末の場合(Windows の Git Bash とか)、ヒアドキュメントを使う。この場合、最後の空行はあってもなくても動作するっぽい。

git credential fill <<EOS
protocol=https
host=github.com

EOS

この例では、github.com 上の Git リポジトリと通信する際に使っている認証情報が表示される。

❯ git credential fill
protocol=https
host=github.com

protocol=https
host=github.com
username=kyanny
password=****************

xref: Git: how to retrieve credentials with Git Credential Manager - @kyanny's blog