Gitosis and Gitweb – Part 2 – Add Projects and Contributors

Gitosis and Gitweb – Part 2 – Add Projects and Contributors

from:http://lostechies.com/jasonmeridth/2010/05/25/gitosis-and-gitweb-part-2-add-projects-and-contributors/


So we are setup now thanks to Part 1.

Gitosis repository contents

If we issue the “find .” command locally inside the gitosis-admin directory we will see the following:

We have the .git folder, a gitosis.conf file, and a keydir with a pub key file.

Add our first project

Our project name for this example is lostechies. If you view the gitosis-admin.conf file you will see the initial content like so:

This is the result of the following command from the last part:

That command puts the public ssh key into the keydirs directory and adds the associated username from the file to be the first member of the gisotis-admin project. Hence seeing user@local as the member. It matches the filename of the pub file in the keydir directory (user@local.pub). That’s how gitosis relates members listed in the conf file to the keys in the keydir directory, filename minus the pub extension.

Let’s edit this conf file to include our lostechies project:

It looks exactly like the gitosis-admin one. Now we commit it just like we would normally when using Git. We can add, then commit or commit with the -am argument. This is possible since the gitosis-admin.conf file is already tracked by the repository.

and push it to the remote gitosis-admin repository:

We need to create the lostechies repository locally, add an initial item (README in this case), and push it remotely. Gitosis won’t create the repository until something it pushed to it.

The lostechies repository now exists remotely. Currently my account is the only that has access. Let’s add another contributor.

Add our first contributors

Say I want to allow my friend Joe to have commit (writable) access to my lostechies repository and I want my friend Ryan to only have readonly access. I tell them to send me their public ssh keys. I make sure the files are named joe.pub and ryan.pub. I then put them into my local gitosis-admin repository’s keydir directory and then I edit the gitosis.conf file to be:

Notice that I had to create a whole new group (lostechies_ro) to setup Ryan’s readonly access. You can’t combine readonly and writable permissions in gitosis (wish we could – open source contribution there?).

Now I need to “git add” the new keys, and commit the changes to the conf file. Finally I push the changes.

Now Joe or Ryan can clone this repository:

NOTE: Again, if they receive the following error:

The solution, involving the .ssh/config file is in the first post in this series.

That is how you create a repository and add users.

DEBUG

If you are unable to connect you have the option of editing the gitosis.conf file with more message verbosity by adding “loglevel=DEBUG” at the top of the conf file:

This will give you more information on the ouput when trying to push to the remote repository.

Can’t push changes

As Scott Chacon states in his gitosis section of Pro Git:

“If you’ve lost push access by pushing a messed-up configuration, you can manually fix the file on the server under /home/git/.gitosis.conf — the file from which Gitosis reads its info. A push to the project takes the gitosis.conf file you just pushed up and sticks it there. If you edit that file manually, it remains like that until the next successful push to the gitosis-admin project.”

The .gitosis.conf file in the git user’s home directory is a symlink to the actual conf file in the gitosis-admin repository:


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值