0
0

More than 1 year has passed since last update.

Please tell me who you are.

Last updated at Posted at 2020-12-29

事象 : Git Guiで[コミット]ボタン押したらエラー

  • 環境
    • CentOS Linux release 7.9.2009 (Core)
    • git-2.31.1

原因は、下の事象と同じでユーザー情報を設定いないから
image.png

対応 : Git Guiでユーザー情報を設定する

Gitコマンドでやってもいいけど、Git Guiの使い方を覚えるためにメニューからやってみる。
参考 : Windows: Git GUIを使う準備 - すたらブログ
初めてオプションダイアログを見たが、いろんな設定ができることを知った。

  1. [編集] > [オプション・・・]でダイアログを表示
  2. [大域(全てのリポジトリ)]にある[ユーザ名][電子メールアドレス]を設定する
    • リポジトリ毎にユーザー情報を変えたければ[xxxリポジトリ]のところ
    • image.png
  3. [保存]ボタンでダイアログを閉じる
  4. 今一度[コミット]ボタンでコミットする

事象 : pullしたら怒られた

  • 環境
    • macOS Big Sur バージョン11.1
    • git version 2.28.0
% git pull origin master --allow-unrelated-histories
#...省略...
*** Please tell me who you are.

Run

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

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident name (for <>) not allowed

対応 : ユーザー情報を設定する

リポジトリ用のユーザー情報を設定する場合
# ユーザー名を設定する
% git config user.name "{ユーザ名}"
# メールアドレスを設定する
% git config user.email "{メールアドレス}"
# configに追記された
% cat .git/config | grep -A 3 user
[user]
    name = {ユーザ名}
    email = {メールアドレス}
グローバルのユーザー情報を設定する場合
# そういえばグローバルの.gitconfigはまだなかった
$ find ~ -type f | grep gitconfig
$

# メールアドレスを設定する
$ git config --global user.email "{メールアドレス}"
# ユーザー名を設定する
$ git config --global user.name "{ユーザ名}"

# グローバルの.gitconfigができる
$ find ~ -type f | grep gitconfig
/home/ponsuke/.gitconfig
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