私はプロジェクトにコミットしようとしていますgithub.com会社の Git サーバー用にすでに設定されている仕事用のラップトップから。異なる構成ファイルまたは他のコマンド ライン スイッチを使用して、異なる作成者の資格情報を指定してコミットする方法はありますか?
使ってみた
--author="My Name <[email protected]>"
そして私は次のメッセージを受け取りました:
Committer: unknown <[email protected]>
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 [email protected]
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
しかし、github.com プロジェクトにコミットするためのユーザー名はまだ更新されませんでした。他に試せることはありますか? また、それは可能ですか?
ベストアンサー1
まず、作成者とコミッターは必ずしも同じではありません。Git は両方を追跡します。
このリポジトリのみに使用する名前を設定するには、次のようにします。
git config user.name "Your Name"
git config user.email "Your email"
オプションがないことに注意してください--global
。これにより、このリポジトリ内の構成のみが設定されます。
あるいは、以下のオプションを使用して、単一のコマンドに対してのみこれを実行することもできます-c
。
git -c "user.name=Your Name" -c "user.email=Your email" commit ...
しかし、上記の設定オプションを使用する方が良いと思います。