2
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 initする前にやっておくべきこと

Last updated at Posted at 2022-04-12

環境

  • macOS Monterey 12.1 (M1チップ)
  • git version 2.35.1

現象

gitコマンドをはじめて利用し、試しに何も考えず
git initしてみたところ、下記のエラーが表示された。

hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>

対応方法

下記コードを実行する。(上記エラーコード5行目の<name>部分に mainを代入する形)

% git config --global init.defaultBranch main
2
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
2
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?