やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

Gitをはじめて使うときはグローバル設定が必要

 *** Please tell me who you are.と訊ねられる。

対象環境

  • Raspbierry pi 3 Model B+
  • Raspbian stretch 2018-06-27
    • git 2.11.0

経緯

 Raspbianをインストールしてから初めてgitを使いcommitしようとしたら発生した。

問題

 commitできず怒られた。

現象

*** 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 <(null)>) not allowed
error: src refspec master does not match any.

 グローバル設定しろと。でもね……

プロジェクトのユーザ設定を使いたかった

 ので、以下のようなコマンドを入力していた。

# リポジトリごとにユーザ名とメアドを設定する
git config --global user.useConfigOnly true
git config --global --unset user.name
git config --global --unset user.email
git config user.name "$username"
git config user.email "$mailaddr"

 なのにダメだった。どうあってもグローバル設定は必要らしい。

参考