weldam $ mkdir ~/pubOne of the things that is hard to find in simple git tutorials is how to set up cooperation with someone, in case you cannot write to the same repository. This document describes how to do that. It is not by itself a git tutorial. Thus it is recommended you read a short git tutorial such as Ralf Ebert’s or read the introductory part of the documentation in the git book.
What we will describe is how to set up your own public repository and working repository in such a way that your own public repository is your origin. This has the advantage that pushing/fetching work with your own public repository by default.
In the example, we use the compute server weldam.ewi.utwente.nl. The recipe also work if you replace this string with the valid login@host.name combination for your SSH server.
Likewise, we use the git repository /home/fmg/sccblom/pub/hoare-logic-tool.git. This can be replaced with the correct location /path/to/bare.git of your (bare) git repository.
On weldam, create (if necessary) a directory for sharing files.
weldam $ mkdir ~/pubOn weldam, copy the existing git repository:
weldam $ rsync -av --progress /home/fmg/sccblom/pub/hoare-logic-tool.git ~/pub
On your PC, clone the git repository:
anywhere $ git clone weldam.ewi.utwente.nl:pub/hoare-logic-tool.git
On your PC, go into the directory:
anywhere $ cd hoare-logic-tool
On your PC, add the repository you copied as a remote:
anywhere $ git remote add sccblom ssh://weldam.ewi.utwente.nl/home/fmg/sccblom/pub/hoare-logic-tool.git
When setting up a repository to be shared with others, it is important that the permission are set correctly and the git server info is up-to-date. Thus the hooks/post-update script is setup to do this automatically.
#!/bin/sh # # An example hook script to prepare a packed repository for use over # dumb transports. # # To enable this hook, rename this file to "post-update". chmod a+rX /home/fmg/sccblom/pub/hoare-logic-tool.git exec git update-server-info
First step is to use wget to mirror the original public repository.
wget --mirror --no-parent --no-host-directories --cut-dirs=2 http://wwwhome.cs.utwente.nl/~sccblom/git/ltsmin/.
Note that you need to use the /. at the end to avoid mirroring other files next to the git repository. . Remove the indices generated by the web server.
rm -f `find ltsmin -name index.html*`
Validate the downloaded git repository:
cd ltsmin git fsck
This is likely to show dangling commits, which are harmless. If other error messages show up ask your local git expert.