LoginSignup
0
0

More than 1 year has passed since last update.

Gitアカウントを複数使い分ける

Posted at

背景

個人開発ではgithub,インターンではgitlabなど複数のアカウントを使い分ける必要があるときの簡易的対処

gitアカウントの設定は2種類ある.

1つ目グローバルを変更 (主アカウント)

~/.gitconfigへ書き込む

git config --global user.name "hoge"
git config --global user.email "hoge@fuga.com"

2つ目リポジトリごとにアカウントを設定(基本これで管理したがいい)

リポジトリの .git/configに書き込む

git config --local user.name "hoge_sub"
git config --loca user.email "hoge_sub@fuga.com"

変更が反映さ入れているか確認

git log

commit  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Author: hoge_sub <hoge_sub@fuga.com> # ここに変更内容が反映されているはず!
Date:   Thu XXX x xx:xx:xx xxxx +xxxx

    add file
0
0
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
0
0