R.A. Epigonos et al.

[git] それぞれのレポジトリで別の名前とメールアドレスを設定する

レポジトリに対してuser.nameとuser.emailが設定されていないと名前とメールアドレスをユーザ名とホスト名を基に自動的に設定されることがある。設定するにはgitディレクトリでgit configする。

まずはレポジトリのcloneをとり、gitディレクトリに移動。

$ git clone *****@********:***********/test.git
Cloning into test...
Enter passphrase for key '/home/****/.ssh/id_rsa':
remote: Counting objects: 1846, done.
remote: Compressing objects: 100% (326/326), done.
remote: Total 1846 (delta 1423), reused 1670 (delta 1323)
Receiving objects: 100% (1846/1846), 1.64 MiB, done.
Resolving deltas: 100% (1423/1423), done.
$ cd test/

適当に編集をしてcommitすると、メールアドレスと名前が勝手に設定される。

$ echo "" >> README
$ git commit -a -m "test commit"
[master *******] test commit
 Committer: **** <****@**********************>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

If the identity used for this commit is wrong, you can fix it with:

    git commit --amend --author='Your Name <you@example.com>'

 1 files changed, 1 insertions(+), 0 deletions(-)

メールアドレスと名前をそれぞれのgitレポジトリで明示的に設定するには、gitレポジトリ(.gitのあるディレクトリで)で以下のコマンドを入力する。

$ git config user.email "i38w7i3@yahoo.co.jp"
$ git config user.name "AYANOKOUZI, Ryuunosuke"

git configに--globalオプションを付けることでこの設定を全てのレポジトリで共有することが出来る。ただし、レポジトリに対して明示的に設定された設定はこれをオーバーライドする。

リファレンス

  1. git config user.email - Google 検索
  2. Help.GitHub - Setting user name, email and GitHub token
  3. Gitの使い方 - SourceForge.JP ヘルプ - SourceForge.JP
  4. 社内のソースコード管理をはじめてGitでスタートさせる。 - それ図解で。・・・tohokuaikiのチラシの裏
  5. git configで出来ること - nabnabの日記
  6. transitive.info - git config 使い方
  7. Pro Git - Pro Git 1.5 使い始める 最初のGitの構成
  8. git config user.name - Google 検索
  9. git configファイルの設定 | Hope is a good thing.
  10. gittutorial(7)
  11. CygwinでGit(GitHub)を始めるための準備・設定メモ - Rewish

ソーシャルブックマーク

  1. はてなブックマーク
  2. Google Bookmarks
  3. del.icio.us

ChangeLog

  1. Posted: 2009-12-30T00:35:37+09:00
  2. Modified: 2009-12-30T00:35:37+09:00
  3. Generated: 2023-08-27T23:09:14+09:00