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 8889453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:16:03+00:00 2026-06-14T22:16:03+00:00

Reading all the tutorials and articles on the internet. As a simple workflow, I

  • 0

Reading all the tutorials and articles on the internet. As a simple workflow, I have understood that we can create a bare repository on our live server and push updates to it from the local repo etc.

My question and concern is that since the live server will also be a Git repo and it would have the .git folder, Wouldn’t that be a security problem? How to prevent access to it?

Update

Suppose my live folder on server is /www and I can access it from the browser http://myserver.com so I can also access http://myserver.com/.git/HEAD ??? How to prevent it?

  • 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-14T22:16:04+00:00Added an answer on June 14, 2026 at 10:16 pm

    You may want to consider separating the repository and the working tree.

    For example, somewhere outside of the folder served by your Web server, run git init --bare. Then replace the config file in this directory with the following (where /path/to/web/root is the path where the files should be placed).

    [core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        worktree = /path/to/web/root
    [receive]
        denycurrentbranch = ignore
    

    Finally add hooks/post-receive with the following contents and mark it executable

    #!/bin/sh
    git checkout -f
    

    Now whenever you push to the repository, the files will be checked out into the correct location and you never have to worry about the repository accidentally being served up.

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

Sidebar

Related Questions

I spent all of yesterday reading various articles/tutorials on Hibernate and although I am
When I first started reading about Python, all of the tutorials have you use
I have been reading all over the web about this and still can't understand
I have this simple code where I am sending http request and reading all
I have never programed in bash before. I am reading all the files that
after searching up and down, reading all possible articles and tutorials, I grasped the
I´m a little bit confused by reading all the posts and tutorials about starting
after reading all posts that come close to this, I still find no solution
I have seen all types of tutorials: View running controller, controller passing model to
All, I am very new to MVC3 / jQuery combo and have been reading

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.