Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8966269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:59:29+00:00 2026-06-15T16:59:29+00:00

I started using git with my .git directory and everything else inside the web

  • 0

I started using git with my .git directory and everything else inside the web root. After further reading it seems this is a bad practice. I’m now placing my application and system folders outside the web root. The only thing left in my web root will be an index file and an asset folder for images, js and css.

Old way

/var/www/assets
/var/www/application
/var/www/system
/var/www/.git

New way (Not really sure where the .git should go with this?)

/var/www/assets
/var/application
/var/system

Before it was easy to set up git. I created the repo and it found all the files because they were all in the same directory. Now, I’m not really that sure where the .git repo should reside in the new structure. If I add it to the /var/www it sees the assets folder but not anything else.

I want to manage all three directories with git. How do I include all the directories into the repo. Or, is there another way that git is designed to handle such instances? I found another question like this on this site, but I couldn’t make sense of it.

Also, on my remote repo I will have it set up like so. I haven’t moved any of the directories around yet. I’ve just been trying to get it to work locally first.

var/www/assets
var/application
var/system
var/git/.git
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:59:31+00:00Added an answer on June 15, 2026 at 4:59 pm

    Instead of moving the two directories out of the repo, I’d suggest moving the web root stuff into a www directory. The way I’d do it is something like the following:

    1. Create a new web root directory:

      # from /var/www
      mkdir www
      git mv assets www
      git mv index* *html www
      git commit
      

      So, the current temporary structure is:

      /var/www/www/assets
      /var/www/system
      /var/www/application
      /var/www/.git
      
    2. You have two choices at this point: either edit your server config to make /var/www/www the new web root. Or move the whole thing somewhere else and symlink the webroot to its original location. I personally prefer the second option:

      # from /var/www
      cd ..
      mv www /usr/local/mywebapp
      ln -s /usr/local/mywebapp/www www
      

      Now your folder structure is:

      /usr/local/mywebapp/www/assets
      /usr/local/mywebapp/system
      /usr/local/mywebapp/application
      /usr/local/mywebapp/.git
      

      But the web serever only sees:

      /var/www/assets
      /var/www/index.html
      

    Doing it this way ensures that your project is always under git control with no changes happening outside of git (and thus unrecorded in git’s history). This also has the advantage that you don’t need to change the remote repo at all. Just push your changes there.

    If you want your app to be installable by others correctly using the symlink method you can always provide a shell script to create the symlink for them and make sure the server configs are correct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started cloning an SVN repository using the git-svn's clone operation. After about 6
I just started using Git and I want to know if this is the
This is probably very simple but I've just started using git. I've installed it
I started using git to track my customizations to a 3rd party web app.
I just started using Git recently and I was reading up on Git best
So I started using Git together with this workflow to make a personal website
I've just started using Git and it's possible I've missed something obvious, but here
I just started using git with github. I followed their instructions and ran into
So I just started using Git and GitHub. It's still a steep climb, but
I am just started using Git, so I apologize if it is a newbie

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.