ragynotes / ragynotes.github.io

🌿 Ragy Notes 📚 https://ragynotes.github.io
https://ragynotes.github.io
1 stars 0 forks source link

how to clone repo with submodule? #43

Closed pskyhx closed 2 years ago

pskyhx commented 2 years ago

A hint from [Issue with adding common code as git submodule: "already exists in the index" - Stack Overflow](https://stackoverflow.com/questions/12898278/issue-with-adding-common-code-as-git-submodule-already-exists-in-the-index)

```bash
$ git ls-files --stage themes/zen 
160000 e83282718738b6b960fb8fbf2bd81d971ec8b096 0 themes/zen

$ git rm --cached themes/zen
rm 'themes/zen'

$ git submodule add git@github.com:ragynotes/hugo-theme-zen.git themes/zen 
fatal: 'themes/zen' already exists and is not a valid git repo

$ git ls-files --stage themes/zen

$ git submodule add git@github.com:ragynotes/hugo-theme-zen.git themes/zen
fatal: 'themes/zen' already exists and is not a valid git repo
```

pskyhx commented 2 years ago

the solution:

$ git rm --cached themes/zen
$ git rm -r --cached themes/zen
$ rm -r --cached themes/zen