2
3

More than 3 years have passed since last update.

GitHubにpushするのに毎度パスワードを打ちたくない!

Posted at

はじめに

開発用にUbuntu 18.04を導入しましたが、、、

GitHubにpushするときに、毎回認証情報(IDとパスワード)を入力させられて嫌になってしまいました。

Git credentialを安全にlinux上で使う方法を調べたのでメモしておきます。

環境

OS:Ubuntu 18.04.4 LTS
Git:version 2.17.1

なお、この方法はGit versions 2.11以上でのみ可能です。

方法

Gitのインストール

aptを使って入れてます。

sudo apt install git

Libsecretのインストール・設定

Gitのcredential.helperlibsecretを登録してあげることで、認証情報を暗号化してlocalに記憶できます。

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

ただし、Xserverが必要という情報がありますので、GUIを使っていない方はもしかしたら使えないかもしれません。

認証を通す

適当なリポジトリで認証を通せば、その認証情報が保存されて次から聞かれなくなります。やったね!

おわりに

これにて、GitHub等にプッシュしまくれる環境が整いました。
さあ草を生やしましょう。

参考

https://hawksnowlog.blogspot.com/2018/10/try-git-credential.html
https://www.softwaredeveloper.blog/git-credential-storage-libsecret

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3