1
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】fatal: not a git repository (or any of the parent directories): .git解消法

Posted at

原因

git remote addgit branchgit commit実行時に以下のようなエラーが出る場合があります。

ターミナル
$ git remote add origin .....
fatal: not a git repository (or any of the parent directories): .git

これは初期設定が不十分な場合に発生します。

解消法

ユーザーに関する設定ができていない場合には以下のコマンドを実行して設定します。

ターミナル
$ git config --global user.name "UserName"
$ git config --global user.email "sample@email.com"

設定できているか以下のコマンドで確認します。

ターミナル
$ cat ~/.gitconfig
[user]
  email = sample@email.com
  name = UserName

次にgitの初期化をします。

ターミナル
$ git init
Initialized empty Git repository in sample-app/.git/

これで正常にコマンドが実行できるようになります。

1
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
1
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?