I'm using shared hosting and I have several website hosted into same server as an addon domain. Now I want to use git for version control
Say I have 3 website as example1.com
, example2.com
& example2.com
. example1.com
is hosted as main domain in public_html/
My dir structure is
/public_html/
.git/
.gitignore
index.html
.....
example2.com/
index.html
.....
example3.com/
index.html
.....
.gitignore
content of example1.com
is
*.log
log/*
tmp/*
.env
/example2.com/
/example3.com/
Now my question is as I already have a git repo in public_html
so how can I initilized a new repo with existing code of example2.com
I create a new project in gitlab as example2 (git@gitlab.com:myusername/example2.git
) now I'm want to push code of
example2.com dir into this repo.
I checked some example as how to achieve this, so I got this and this. So I tried below cmd from public_html
.
git submodule add https://gitlab.com/myusername/example2.git example2.com
But I'm getting below error
The following path is ignored by one of your .gitignore files: example2.com Use -f if you really want to add it.
If I remove example2.com
from root .gitignore
then it'll add the code in to my example1.com repo. I'm too confused as how to maintain separate commit/repo for sub-folder
Can anyone help me with there knowledge.
Thanks in advance.