Greytree

TamWiki

For a mouse who is a packrat

Technology » How To Set Up Your Own Private Remote Repository
How to set up your own private git repository on a remote server

Summary:this is what goes at the top of the site

(redirected from Main.HowToSetUpYourOwnPrivateRemoteRepository)

<< Prev: Git Submodules

Up: ^Git^

This is a slightly modified and localized copy of this article

Set up the server

These instructions were performed on a CentOs 5.5 box.

First, if you haven’t done so already, add your public key to the server:

 $ ssh myuser@server.com mkdir .ssh
 $ cat .ssh/id_rsa.pub | ssh myuser@server.com 'cat >> .ssh/authorized_keys'

(Don't do this if you've already uploaded your public ssh key!)

Add your repositories

Login to the server:

 $ ssh myuser@server.com

Now we can create our repositories:

 $ mkdir -p path/to/myrepo.git
 $ cd $!
 $ git init --bare .

The last steps creates an empty repository. This assumes there is a local repository to push to the remote server.

Log out of the server.

Configure your development machine

Add the remotes to the local machine. If you’ve already defined a remote named origin (for example, if you followed GitHub’s instructions), you’ll want to delete the remote first:

 $ git remote rm origin

Now we can add our new remote:

 $ git remote add origin myuser@server.com:path/to/myrepo.git
 $ git push origin master

And that’s it. You’ll probably also want to make sure you add a default merge and remote:

 $ git config branch.master.remote origin
 $ git config branch.master.merge refs/heads/master

And that's it!


Tags: Categories: HowTos

Recent Changes | Printable View | Page History | Edit Page
Page last modified on April 17, 2012, at 08:59 PM by ImportText?