Search code examples
gitgitosis

How to move local Git repository (with history) to be managed by Gitosis on remote server?


I'm switching from SVN to Git with Gitosis installed on a central server for centralized repositories on Ubuntu server.

I have had all my SVN repositories moved and initiated into new Git repositories, and also had all history moved to Git.

Now that I have all the repositories migrated to Git, I want to add all the repositories into Gitosis to be managed by Gitosis.

How can I move the repositories (Git initiated ones) into Gitosis /srv/gitosis/repositories and manage them through gitosis-admin.git remotely?


Solution

  • The idea is to declare you repo in the conf/gitosis.conf file from your gitosis-admin local (cloned) repo:

    [group groupname]
    writable = reponame
    members = username
    
    git add -A
    git ci -m "updated configuration"
    git push
    

    , which will create a bare repo, to which to which you can push your local repo.

    mkdir myproject
    cd mypyroject
    git init
    # do some work, git add and commit files
    # Then add your server as a remote and push:
    
    git remote add serveralias git@hostname:reponame.git
    git push serveralias master
    

    See this tutorial for more


    That being said, I find gitolite much more complete than gitosis, like all those recent blog posts illustrate:

    And you can migrate from gitosis to gitolite easily enough.