Gitをhttps経由で使用する時のパスワードの保存方法
スポンサーリンク
gitをhttps経由で使用する場合に毎回パスワードを聞かれるのを回避する方法
使用可能な方法を調べる
$ git help -a | grep credential- credential-cache remote-ext credential-cache--daemon remote-fd credential-gnome-keyring remote-ftp credential-store remote-ftps
git-credential-cacheを使う
タイムアウト期間内でパスワードをcache上に保存する
$ git config --global credential.helper cache
タイムアウト時間はデフォルトでは900秒なので変更したい場合は以下のようにする
$ git config --global credential.helper cache --timeout=1800
gnome-keyringを使う
初回入力時にGNOMEキーリングにパスワードが保存され,それ以降は入力不要
- CentOS7
$ git config --global credential.helper gnome-keyring
$ sudo apt-get -y install libgnome-keyring-dev $ cd /usr/share/doc/git/contrib/credential/gnome-keyring/ $ git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring