LoginSignup
10
7

More than 5 years have passed since last update.

githubのコミット名(コミットする人の名前)の変更 < Commiter Author >

Last updated at Posted at 2016-10-28

コミットする人の名前の変更について

githubでコミットした際に、コミットする人の名前を変えたい時や、
別のPCを使っていても、名前を統一したい時に、こちらの記事を参考にして頂ければ幸いです。

変更コマンド

グローバル設定

ホームディレクトリ/.gitconfigで定義している情報

git config --global user.name "sumple"
git config --global user.email sumple@tokyo.com

ローカルリポジトリ設定

リポジトリごとの/.git/configで定義している情報

git config user.name "sumple"
git config user.email sumple@tokyo.com

確認コマンド (初期はusernameとかないが、設定すると入っている)

git config --list

実際にやってみよう

下記のようにコマンドを打って見る

git config --global user.name “g_user"
git config user.name “l_user"

確認してみる。二つ名前がある

MacPro:cake admin$ git config --list
credential.helper=osxkeychain
user.name=g_user
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=https://github.com/〇〇/〇〇.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
user.name=l_user
MacPro:cake admin$

コミットしてブラウザで見るとこんな感じ (グローバルでないユーザーの名前が表示されている)
git.png

ちなみに、globalで指定してあるものは、他のgitディレクトリでも、共通の名前が書かれているが、
もう一つの名前は、git config —list で出しても、出でこない。ので、gitディレクトリを新たに作成したら、usernameを指定すれば、その名前でコミットできるし、しなければ、globalで指定してある名前でコミットされるようです。

参考URL

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