3

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 ([email protected]: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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.