Using Gitolite repositories

Ian Channing edited this page Jan 28, 2014 · 7 revisions

Gitolite is a popular system for managing GIT repositories, and handles both the creation of new repositories and the user access control to those repositories.

Configuring your Gitolite repository for use with Sparkleshare

First, each Sparkleshare user will need RW+ access to your Gitolite repository. This requires choosing a username for each Sparkleshare user and adding them to the conf/gitolite.conf file in Gitolite's gitolite-admin repository. Instructions for creating and cloning this admin repo can be found on their Github page or their documentation. An example configuration excerpt:

repo	SparkleRepo
		RW+  = sparkleuser

Second, each user's key must be added to Gitolite. These take the form of ".pub" files in the keydir folder of gitolite's admin repo. If your users are using the default keys that Sparkleshare generates, the "Usernames's link code.txt" file that Sparkleshare generates is all you need - copy that file into the "keydir" folder and rename it "sparkleuser.pub" (or similar).

Commit and push the gitolite-admin repository for these changes to take effect. The repository should now exist on the server.

Repositories for multiple users / computers

Since SparkleShare creates a new private key for each computer, you have to add a new public key for each computer that is going to connect to the repo. You can try the following template for creating shares:

@sparkle[user1]    =   sparkle[user1][pc1] sparkle[user1][pc2]
@sparkle[user2]    =   sparkle[user2][pc1] sparkle[user2][pc2]
[user1]-[[user2]-][crypto-]share = "Shared box"
repo     [user1]-[[user2]-][crypto-]share
	RW+ =   @sparkle[user1] @sparkle[user2]
	
# e.g. Jim's own repo
@sparklejim    =   sparklejimpc1 sparklejimpc2
jim-share = "Jim's box"
repo     jim-share
	RW+ =   @sparklejim		

# e.g Jim and Bob's shared encrypted repo
@sparklejim    =   sparklejimpc1 sparklejimpc2
@sparklebob    =   sparklebobpc1 sparklebobpc2
jim-bob-crypto-share = "Shared encrypted box"
repo     jim-bob-crypto-share
	RW+ =   @sparklejim @sparklebob		

Adding your Gitolite repository as a remote folder in Sparkleshare

Gitolite supports several different syntaxes for the address of a repository. However, when entering the address for a Gitolite repository as a new remote folder into Sparkleshare, it appears that the following specific syntax is required:

Server type: My own server
Address: ssh://gituser@server:port
Folder name: SparkleRepo or SparkleRepo.git (either should work) where SparkleRepo is the name of your Git repository.

No slashes or colons are required anywhere. Even though your git repo is probably in a subdirectory ie has a path such as ~/repositories/mygitrepo.git you should not enter any part of the actual server path into Sparkleshare.

Troubleshooting

If you are experiencing problems, it may be helpful to confirm that the user can access the Gitolite repository in the normal fashion eg attempt a checkout of the repository via the command line first, and when this works simply delete that local copy.

Refer to https://github.com/hbons/SparkleShare/issues/166 for more information.