gitdvcs

Internal Repository Setup


I have jumped on the GIT bandwagon lately. I am confused about which DVCS hosting to use. I am in a notion that i can setup my own thing on a dedicated/vps server.

So, my question is that, how to setup my own internal remote repository management system on the dedicated server that i have?

Please guide.

Regards


Solution

  • On the server run the following command in a directory you want to use...

    git init --bare
    

    This creates an empty/bare repository on the server.

    On the client run the following command in an existing git repository (assume you know how to do this)...

    git remote add myserver <url/path>
    

    This adds a remote / link to your server. Path can be local, remote (http, ssh, etc).

    For more info on setting up git over ssh see the following article.

    To push code to your server do the following...

    git push myserver master
    

    This pushes your commits up to the remote server. Where 'myserver' is the alias you gave to your remote location

    git pull myserver master
    

    With git pull you download/pull all the commits from the server.

    Edit Github is great and has a lot of additional features, but it is good to know how to set up a git repository yourself.