I started using git very recently and still havent setup a remote repository before, so I am totally lost.

This is my setup: I have a repository in my local machine, which I want to publish in our dedicated server (outside the local network). How do I setup a remote git repository in this server, with a security config and whatever else is necessary?

Edit: this would be a private repository, so only me and a few people can access it. I guess there are a lot of ways to go about this, so please explain the easiest solution that meets these requirements.

  • 1
    you may want to be more specific, there is several ways. Do you intend for people to anonymously access the repo with a URI like git@host:/project.git or just access for yourself via user or root account with a URI like root@host:/project.git or even over http (not sure if that is an option)
    – Tim
    Commented Dec 28, 2011 at 18:34
  • Just me and two more people, so we would have to secure it. Please tell me if you need to know anything else
    – ooops
    Commented Dec 29, 2011 at 13:22

3 Answers 3


The way I do this is to first add a user 'git' to the remote server - then mkdir project.git, cd project.git and then initialize a bare repository with git init --bare then on the local machine: git remote add origin [email protected]:project.git followed by: git push origin master hope that helps


An alternative is to use gitolite which provides access control on top of git. It will save you the headache of having to create and configure access for each user on the server. If like github then you can use gitlab (which uses gitolite) to manage your repos via the web. All in all they will both save you the headache of having to manage users server side. Hope this helps


I believe an answer has already been posted here that will help you, please look at Create SSH user with limited privileges to only use Git repository

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .