0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

gitの初期設定に関するメモ

Last updated at Posted at 2022-11-04

pullするときは特に必要ないけどpushするときは必要.

名前とメアド

git config --global user.name "hoge hoge"
git config --global user.email hoge.hoge@hoge.com

GitHubでメールアドレスを非公開にしたい場合はnoreplyメールアドレスを用いる.これはGitHubのsettings->EmailsのPrimary email addressのところに書いてある${8桁の数字}+${username}@users.noreply.github.comのことである.
2022-11-04_07-10-11_region.png

デフォルトのブランチ名をmainに変更

git config --global init.defaultBranch main

Pullしたときの挙動

git config --global pull.rebase false

これが無難.これでWarningが出なくなる.

.gitconfig

これらの設定をすると~/.gitconfigに追加されるので,コマンドを打たずに直接書きこんでも良い.

[user]
 name = "hoge hoge"
 email = hoge.hoge@hoge.com
 [init]
 defaultBranch = main                                                                                                         
 [pull]
 rebase = false

特定のディレクトリ(例えば~/Hoge)の中では別の設定ファイル(例えば~/.gitconfig-hoge)を用いたいときは~/.gitconfigに以下のように記述する.

[includeIf "gitdir:~/Hoge/"]
path = ~/.gitconfig-hoge
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?