LoginSignup
2
2

More than 5 years have passed since last update.

GithubでUsernameとPasswordを省略

Posted at

何がしたいか

なるべく安全に楽したい。

  • usernameを省略できるようにする
  • passwordを一定期間だけ省略できるようにする

usernameを省略できるようにする

git cloneのときに <username>@を追加する

git clone https://<username>@github.com/<username>/<repository name>.git

clone済みの場合は.git/configを同じように修正する

[remote "origin"]
        url = https://<username>@github.com/<username>/<repository name>.git

passwordを一定期間だけ省略できるようにする

Caching your GitHub password in Gitをやる。
Linuxの場合を下記に記載。

git config --global credential.helper cache
# or 
# git config --global credential.helper 'cache --timeout=3600'

自分の場合は--timeout=10800にして3時間ほど再入力しなくても良くなるようにしている。

背景

Gitは業務で使っているからコマンドはなんとなくわかるのだけど、Githubは使ったことがなかった。
業務ではGerritとSSHの組み合わせを使っているはず。だけど、普段から気にしているわけでもないし、初期設定なんて1回しかやらないだろうから、今更感はあるがまとめておいた。

2
2
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
2