I am trying to add a git submodule. The submodule itself works without any problem but my question is about the created layout when adding the submodule.
I am adding a simple submodule called utils that only contains a file.
I am using this
git submodule add --force ssh://myserver/home/git_repositories/utils js/utils
because I want to add the submodule utils into the js/utils folder
the problem is that after doing this operation, inside of the js/utils folder i find another folder called utils, like js/utils/utils and there I find my javascript.
I want to have a layout like js/utils/ and here my javascript.
I have tried to eliminate the /utils in the git submodule add like
git submodule add --force ssh://myserver/home/git_repositories/utils js/
but then git yields
'js' already exists in the index
Do you know any way to avoid that secondary /utils?
Thanks a lot in advance!
prussian blue
I have found that the problem was in my original utils repo.
Apparently I forgot to do git init in that particular folder and therefore it was getting the parent as root level, thus creating that extra unwanted /utils
To solve this, I simply had to do git init inside of the utils folder, git add . , git commit and push. When pulling as a submodule, now it has the right layout!
My bad! Hope this helps someone and many thanks for your help guys.
Try this:
.gitmodules
file; .git/config
file; git rm --cached submodule_path
; rm -rf submodule_path
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.