cygwin 下建立用gitosis建立git中心服务器(2)

4 views
Skip to first unread message

小刀客

unread,
Nov 9, 2009, 11:46:28 PM11/9/09
to programming with GNU software
9、用windows管理工具创建一个用户 git ,并设置密码
在cygwin 下 mkpasswd -l -u git >> /etc/passwd
10、创建公钥
$ ssh-keygen -t rsa -C "tek...@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Tekkub/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Tekkub/.ssh/id_rsa.
Your public key has been saved in /c/Users/Tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
e8:ae:60:8f:38:c2:98:1d:6d:84:60:8c:9e:dd:47:81 tek...@gmail.com

cd ~/.ssh
ls
config id_rsa id_rsa.pub known_hosts

chmod 755 /tmp/id_rsa.pub
cp id_rsa.pub /tmp/idrsa.pub

11、在windows cmd下,运行 runas /user:git path/cygwin/cygwin.bat
gitosis-init < /tmp/id_rsa.pub
你会得到如下信息:
Initialized empty Git repository in /home/git/repositories/gitosis-
admin.git/
Reinitialized existing Git repository in /home/git/repositories/
gitosis-admin.git/
12、再运行cygwin
chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-
update
13、使用gitosis管理project user
ssh git@your-server 取得ssh key,不要管显示的其他错误信息
git clone git@your-server:gitosis-admin.git

Inside the cloned repository there is a folder named keydir and a
config file named gitosis.conf. Adding a new user is as simple as
adding their key to the keydir folder. You will also notice that your
own key which we initialised gitosis with earlier has automatically
been added. Also, the filename will have changed to match the key
comment (often this is in the form of user@hostname). To add a new
repository, crack open the config file in your favourite text editor.
You will see the following:

[group gitosis-admin]
writable = gitosis-admin
members = me@myhost

I added a new group and left the gitosis-admin one intact. A group is
a nice easy way of dividing up which users can read/write to what
repositories.

[group me-and-my-friends]
members = me@myhost
writable = cool-new-project

More than one user and/or repository can be added to any group
section, and there may be multiple group sections. This is
particularly useful if you have a team and wish to be broken down into
smaller subteams. A quick example:

[group team1]
members = john bob sarah
writable = project1 project2

[group team2]
members = bob tina tom
writable = project3 project 4
Once the keys and config file are added or updated, commit and push
the repository back to the server. Gitosis will update its
configuration automatically.
14、创建新的代码库
The new repositories can be created locally using git init. You can
then go about adding all your new files in the usual way and push the
repository to the server after adding a new remote (normally called
'origin'):

git remote add origin git@myserver:cool-new-project.git
git push origin master:refs/heads/master

This will create the repository on the server at the given URL and
make it available to all those for whom you granted access. Be sure to
use the same repository name in the gitosis config file as you do on
the URL (with '.git' appended).
Reply all
Reply to author
Forward
0 new messages