How can I host Git repositories and manage my content-hosting myself?

Things such as Github, Bitbucket, DropBox -- manages the content-hosting such as tickets and repo -hosting (DB not tickets but can be used to store repos). I want a solution where I manage myself the content-hosting of thing such as Git -repositories and tickets.

Trial 0: trying to tune Git, too time-consuming

I followed the instructions here but some difficulties then I followed a lot of other tutorials with much more difficulties. I got cloning with "git clone --bare xxx xxx.git; cd xxx; git update-server-info" working but unable to push things with "--shared", got fed up to this kind of manual hacks. There is too much material, too much irrelevant material and too much outdated material.

I repeat I want to do the content-hosting myself. So how can I host my git repos?

Perhaps related

  1. Git repository server I can host locally

  2. Recommendation for code hosting of personal projects

Answers


If you're running a Linux server an option is to use Git + SSH.

On The Server

  1. Create a user account called git which has permissions over your main git project directory. This is useful for allowing all collaborators to push on shared projects.

  2. Add the RSA public key for each of your client machines to the authorized_keys file on the server. (You can generate a private-public key pair using ssh-keygen -t rsa -b 4096 on most Linux distributions.)

  3. Create a new bare repository for your project as the git user. git init myproject --bare

On the Client

  1. Turn on private key authentication by enabling the IdentifyFile in your ssh_config.

  2. Clone the bare repository. git clone git@<server>:/var/git/myproject

  3. Make your changes.

  4. Commit the changes and push them back to the remote repo. git push origin master

If you need more specific instructions (such as the exact commands to create a user account) checkout the official Pro Git book.


I would go with Gitolite (manages the permissions) here and Redmine (manages the workflow over many repos) here. If you have no need for permission -management, please, go with Michael's solution. If you do not need to manage many repos, forget Redmine (useful with many repositories). The stuff here contain the same stuff as in Michael's answer but in third-party sites and some additions that you may need when your projects expand.

0. Git + SSH -keypair (Please, see the Michael's answer and below some outlining.)

If you are unable to do this, do not proceed forward -- this method shows the basic way of using bare -repos to content-host your repos. It takes some 2 minutes' time to do it, simply:

On server

$ git init --bare test.git

On client

$ eval `ssh-agent`
$ ssh-add ~/your_auhorized_key_in_server
$ git clone something@IP:test.git

1. Gitolite (managing perms of a team with different skills)

  1. excellent step-by-step tutorial here (notice the "~/.ssh/authorized_keys" -file must have only gitolite -user)

  2. check out repository -addition/removal here, yes it is that simple -- you just configure the config -file and then "$ git add .; git commit -m "new repos, old dead" and "$ git push"

  3. "$ ssh gitolite@xxx.yy.112.239 info" shows you the configuration

            hello hhh, this is gitolite@ip-10-xxx-xx-203 running gitolite3 v3.03-29-g3c0f177 on git 1.7.4.5
    
             R W    helloworld
             R      gitolite-admin
             R W    testing
    
  4. Cloning a repository under gitolite

    $ git clone gitolite@176.34.112.239:helloworld

2. Redmine/Trac/etc (managing workflow over repos in a central GUI place)

Instructions here for Redmine and be sure not to clone the unstable development branch in Github. You need to download some stable archieve. However, I would probably go with Trac, comparison here. Redmine was some Rails -hack and unstable master -branch does not sound good.

3. Ticgit/etc (managing tickets without thirdparty dependencies)

Bremner outlined this issue here but notice this ticket here, things still in very bad shape. General thread here.


Need Your Help

Why MAMP sets to 600 MySQL file permission?

mysql svn mamp

I usually put MAMP MySQL /db/db-site-name folder under SVN.

Refreshing Marquee Text on Android

android textview marquee

On launch, my marquee text is working normally. Then i want to update text in somewhen. I get text on internet and set it to textview: