簡體   English   中英

為什么我不能在現有存儲庫中進行“ git clone repo”,而不能在現有存儲庫的子文件夾中進行“ git remote add origin repo”?

[英]Why can I do “git clone repo” inside an existing repo but not “git remote add origin repo” inside subfolder in an existing repo?

這個問題源於上一個問題,我試圖在一個已經存在的存儲庫中的子文件夾中創建一個存儲庫。

當我創建文件夾並在其中運行“ git remote add origin ...”時,出現以下錯誤:

fatal: remote origin already exists.

但是,當我CD返回上一個文件夾並運行時:

git clone someNewRepo

它可以完美地工作,我可以單獨使用該存儲庫。

我的問題是,我現在是否正在使用git子模塊,或者這是不應該實際工作的解決方法?

您需要在git remote add之前git init一個新的子存儲庫,以獲得與git clone相同的行為。 如果這樣做,它將按預期工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM