最近、ファイアウォールの問題により、リポジトリを GitHub の https:// に同期するように切り替えましたが、毎回パスワードを求められます。
毎回認証するのではなく、資格情報をキャッシュする方法はありますかgit push
?
ベストアンサー1
Git 1.7.9(2012年リリース)以降、HTTP / HTTPSでパスワードを毎回入力しなくても済むようにする便利なメカニズムがGitに導入されました。資格情報ヘルパー。
次のいずれかの資格情報ヘルパーを使用できます。
git config --global credential.helper cache
のcredential.helper キャッシュ値Git にパスワードを特定の時間(分)メモリにキャッシュしておくように指示します。デフォルトは 15 分ですが、次のようにしてより長いタイムアウトを設定できます。
# Cache for 1 hour
git config --global credential.helper "cache --timeout=3600"
# Cache for 1 day
git config --global credential.helper "cache --timeout=86400"
# Cache for 1 week
git config --global credential.helper "cache --timeout=604800"
必要に応じて資格情報を永続的に保存することもできます。以下の他の回答を参照してください。
GitHubのヘルプまた、Mac OS Xをお使いの場合は自家製Git をインストールするには、ネイティブの Mac OS X キーストアを次のように使用できます。
git config --global credential.helper osxkeychain
Windowsの場合、ヘルパーと呼ばれるものがありますWindows 用 Git 資格情報マネージャーまたはmsysgit の wincred。
git config --global credential.helper wincred # obsolete
とWindows 用 Git 2.7.3+(2016年3月):
git config --global credential.helper manager
Linuxの場合は(2011年)を使用します。gnome-keyring
(または KWallet などの他のキーリング実装)。
現在(2020年)では、それは(Linux上で)
フェドーラ
sudo dnf install git-credential-libsecret
git config --global credential.helper /usr/libexec/git-core/git-credential-libsecret
ウブントゥ
sudo apt-get install libsecret-1-0 libsecret-1-dev
cd /usr/share/doc/git/contrib/credential/libsecret
sudo make
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret