【Git】問題解決: You've added another git repository inside your current repository.

問題解決:刪除重複的 `.git` 資料夾,排除 Git 儲存庫嵌套錯誤的方法。

前言

這篇是git上傳時,
碰到以下訊息的解決方法。

You've added another git repository inside your current repository.

解法

簡單來說此問題是因為在git資料夾底下中,
已經存在一個已經建立git的資料夾,
導致git的指令出錯。

我們必須去資料夾底下找尋已經起始 git 的「.git」資料夾 (通常是隱藏的資料夾)
刪除此資料夾後即可正常執行 git 上傳。

示意圖

  • git 資料夾
    • (資料夾內) 曾經 git init 過的資料夾 (必須刪除此 .git 資料夾)
  • Reference

    Licensed under CC BY-NC-SA 4.0
    使用 Hugo 建立
    主題 StackJimmy 設計