Gitosis — Creating projects and allowing users to access them

Creating Projects, Giving Users Access

NOTE: I apologize for late posting of this — got hung up in my drafts folder and I got busy with other things.

Where we’re at:

Now that we’ve got Gitosis and some users set up, it’s time to add some actual repositories.

Create a new git repository (skip this if you’ve already got one)

  • Create a home for it
        # mkdir foo; cd foo
    
  • Turn it into a repository

    # git init

  • Add something to it and commit it so we can prove it's working later:

    # cat gt; README.TXT
    README.TXT -- a file with no purpose other than to prove it can be cloned
    ^D
    # git add README.TXT
    # git commit -a -m "Added README.TXT"

Adding the repository to gitosis-conf and push it to the server

  • Set up access in the gitosis-conf

    First, set up a new group, add users (include yourself!), and indicate what they can write to:

        [group myteam]
        members = jdoe you@yourmachine.local
        writable = foo
    
  • Push those configuration changes to the server so you'll have permission on the server to push up the new repository:

        # git commit -m "Added myteam, foo project, gave access to jdoe"
        # git push
    
  • Change to the directory containing your new repository, and flag the local repository as originating on the server running gitosis in the repository foo.git:
        # cd em>whereverYourRepositoryIs/em>
        # git remote add origin git@YOUR_SERVER_HOSTNAME:foo.git
    
  • Our local copy has committed changes, push them up to the remote repository:
        # git push origin master:refs/heads/master
    
  • To test your setup, go to a brand new directory, and attempt to clone your new repository:
        # cd ~
        # git clone git@YOUR_SERVER_HOSTNAME:foo.git
        # cd foo
    

    You should now have a clone of your repository in ~/foo!

Just for fun, you could run:

	# cd ..
	# diff whereverYourRepositoryIs foo

No output means they're identical, which they should be except for the notice from diff about the .git directory that exists in both repositories:

	Common subdirectories: whereverYourRepositoryIs/.git and foo/.git