Difference between revisions of "GitSuperRepoAdminGuide"
Line 1: | Line 1: | ||
''Include here a guide to setting up a Git server with a Cactus super-repository'' | ''Include here a guide to setting up a Git server with a Cactus super-repository'' | ||
+ | |||
+ | <span style="color:red">Currently this is very disordered and too complicated.</style> | ||
<pre> | <pre> |
Revision as of 05:26, 24 June 2011
Include here a guide to setting up a Git server with a Cactus super-repository
Currently this is very disordered and too complicated.</style>
############################################################################### # CactusGit ############################################################################### # Introduction # This package allows you to check out Cactus using GetComponents from # a CRL thornlist using git-svn instead of svn for the svn # repositories. This means that your local Cactus tree contains # complete version information and history and can be managed using # git rather than svn. # Further, the package provides tools for creating a # "super-repository" for the tree with pointers to the downloaded # repositories as git submodules. This means that the state of the # tree can be identified by a single commit ID and can be cloned # directly without having to use GetComponents or git-svn. # Notes # * To make this more convenient, small wrapper scripts can be written # to replace the recipes given below # # * GetComponents could be extended to support git-svn directly, # rather than using the wrapper-script approach that is currently # used # Tutorial # Add our tools to the path, including the svn wrapper which tricks # GetComponents into making a git-svn clone of each svn repository. # We also include a copy of GetComponents here for convenience. export OLDPATH=$PATH PATH=$PWD/bin:$PATH # Check out the tree into the Cactus directory (can take a very long # time, ~60 minutes, and does not show progress for each repository # until it has checked it out completely) GetComponents -v -a WaveToy.th # Now manually checkout any thorns which require authentication git svn clone ... # Add the git-svn repos to your server (also add the Cactus super-repo). crlrepos WaveToy.th > gitsvn.list cd <gitolite_dir> vi conf/gitolite.conf # Add the repositories in gitsvn.list git commit conf/gitolite.conf git push # Add a 'fetching and pushing' (fp) user vi conf/gitolite.conf git commit conf/gitolite.conf git push # Push as the fp user scp Cactus fp@server:fetch/ scp gitsvn.list fp@server:fetch/ ssh fp@server cd fetch for i in `cat gitsvn.list`; do cd $i && git remote add bare cactus@localhost:$i && git config --unset remote.bare.fetch && git config remote.bare.push 'refs/remotes/*:refs/heads/*' && git push bare && cd -; done # On the server, update the HEAD of the git-svn repos ssh cactus@server cd ~/repositories for i in `cat ../fetch/gitsvn`; do cd $i.git && git symbolic-ref HEAD refs/heads/git-svn && cd -; done # Generate a super-repository called CactusGit using all the # repositories from Cactus listed in WaveToy.th crltogit CactusGit cactus@server: Llama.CTGamma.ET.th # Add non-svn repos GetComponents Llama.CTGamma.ET.th rm -rf repos git submodule add ... repos/... # Symlink flesh ln -s flesh/CONTRIBUTORS ln -s flesh/COPYRIGHT ln -s flesh/Makefile ln -s flesh/doc ln -s flesh/lib # Commit symlinks (as fp) git add * git commit ... git push cactus@localhost:Cactus master:master ######### Administrators ######## # Updating the git-svn mirrors for i in `cat gitsvn.list`; do cd $i; git svn fetch && git push bare; cd -; done # Updating the hg-git mirrors for i in `cat githg.list`; do cd $i; hg pull && hg push git; cd -; done # Updating the git mirrors for i in `cat git.list`; do cd $i; git fetch -a -u && git push bare --all; cd -; done # Updating all submodules in the super-repo cd Cactus git pull git submodule foreach git pull git commit -m "Update submodules." -a # Updating a single submodule in the super-repo cd Cactus cd <repo-path> git pull cd - git commit -m "Update submodule <repo-path>." <repo-path> # Automatic updates of super-repo git clone --recursive cactus@localhost:Cactus cd Cactus git submodule foreach 'git remote set-url origin /var/cactus/repositories/$path cactus@git.barrywardell.net:/$path; echo OK' git remote set-url origin /var/cactus/repositories/Cactus git remote set-url --push origin cactus@git.barrywardell.net:Cactus git checkout submodules git pull origin submodules git submodule foreach 'git fetch origin && git checkout origin' git commit -m "Update submodules." -a git push origin submodules # Adding a git-svn repo vi conf/gitolite.conf git commit conf/gitolite.conf git push ssh fp@server cd fetch vi gitsvn.list # add <newrepo> git svn clone -s <url> <newrepo> cd <newrepo> git remote add bare cactus@localhost:<newrepo> git config --unset remote.bare.fetch git config remote.bare.push 'refs/remotes/*:refs/heads/*' git push bare cd ~/repositories/<newrepo> git symbolic-ref HEAD refs/heads/trunk cd ~/fetch/<newrepo> git pull bare # Adding a hg-git repo vi conf/gitolite.conf git commit conf/gitolite.conf git push ssh fp@server cd fetch vi githg.list # add <newrepo> hg clone <url> <newrepo> cd <newrepo> vi .hg/hgrc # Add: # [path] # git = git+ssh://localhost/<newrepo> # [git] # intree = 1 hg gexport # Can take quite a long time hg push git # Adding a git mirror repo vi conf/gitolite.conf git commit conf/gitolite.conf git push ssh fp@server cd fetch vi git.list # add <newrepo> git clone --mirror <url> <newrepo> cd <newrepo> git remote add bare cactus@localhost:<newrepo> git config --unset remote.bare.fetch git push bare --all # Adding a submodule to the super-repo git submodule add <url> <path> git commit git push # Removing a submodule from the super-repo vi .gitmodules vi .git/config git rm --cached <path> git commit ... git push # Changing svn URL for a git-svn clone. WARNING: this is rewriting the history of # the git-svn branch of your mirror and will mess peoples checkout up. cd fetch/<repo> git status git gc git filter-branch --msg-filter 'sed "s/git-svn-id: http/git-svn-id: https/g"' $(cat .git/packed-refs | awk '// {print $2}' | grep -v 'pack-refs') sed -i -e "s/http/https/g" .git/config rm -rf .git/svn git svn rebase git push bare --force # Changing svn URL without rewriting history (https://git.wiki.kernel.org/index.php/GitSvnSwitch): Edit the svn-remote url URL in .git/config to point to the new domain name Run git svn fetch - This needs to fetch at least one new revision from svn! Change svn-remote url back to the original url Run git svn rebase -l to do a local rebase (with the changes that came in with the last fetch operation) Change svn-remote url back to the new url Run git svn rebase should now work again!