LoginSignup
196
194

More than 5 years have passed since last update.

同じマシンで複数のgithubアカウントを使い分ける

Last updated at Posted at 2013-05-27

例えば、個人ではGithub、会社ではGHEのアカウントを持っているなどの場合、同じマシンでアカウント(コミッター名)を使い分ける方法。
単純に、--globalを付けなければリポジトリ単位で設定できるので、使用頻度が高い方を--globalで設定し、もう一方はリポジトリ単位で設定する。
ファイルでいうと、--globalをつけるとhomeの設定~/.gitconfigに、つけないとそのリポジトリ内の設定./.git/configに書かれるということになる。

メインのアカウント(~/.gitconfig)
git config --global user.name "メインアカウントのユーザ名"
git config --global user.email "メインアカウントのメールアドレス"
サブのアカウント(./.git/config)
cd [ローカルリポジトリのディレクトリ]
git config user.name "サブアカウントのユーザ名"
git config user.email "サブアカウントのメールアドレス"
196
194
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
196
194