LoginSignup
0
0

More than 1 year has passed since last update.

エラー「warning: adding embedded git repository」が発生した。

Last updated at Posted at 2021-06-06

今回発生したエラー

任意のディレクトリでリモートリポジトリを作成し、git add . をしたところ今回のエラーが発生した。

$git init
$git add .

warning: adding embedded git repositoryを翻訳すると 「警告: 埋め込まれた git リポジトリを追加しています」 となる。

エラー発生原因

任意のディレクトリのカレントディレクトリや親または子のディレクトリに、誤って git init してしまっている。

エラーの解決方法

  1. 誤って git init してしまったファイルを探す。
  2. 発見したファイルの .git を削除する。

具体的なエラー解決方法の手順

誤って git init してしまったファイルを探す。

  • cd コマンドで任意のファイル周辺のディレクトリに移動しする。ls -a コマンドで .git が存在しない確認する。

        または  

  • cd コマンドで親のディレクトリに移動する。find . -type d -name '.git' コマンドで .git が存在しないか確認する。
$cd ファイルパス
$ls -a

または

$cd 親ディレクトリのパス
ファイル$find . -type d -name '.git'

発見したファイルの .git を削除する。

  • cdで発見したディレクトリに移動し、rm -rf .git コマンドで .git を削除する。 
$cd ファイルパス
$rm -rf .git

 

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