Setting Up Git Server Using Gitosis
来源:互联网 发布:python sys.stdin用法 编辑:程序博客网 时间:2024/06/05 03:10
Gitosis is a software for hosting git repositories witten by Tommi Virtanen. It manages multiple repositories under the same user account. It uses SSH public keys to identify users. Users do not need shell accounts on the git server. The operations are done under the shared account.
One benefit we can get from gitosis is that we can give different suers different write/read rights over different repositories. Another benefit is easier user and repository management. The management is done by a special repository named gitosis-admin.git on the server.
Let’s look at how to set up a git server using gitosis. Here we want to set up a git server on example.org. Please refer to Managing Repositories on Git Server Using Gitosis for how to manage and use the repositories managed by gitosis.
Install git and gitosis on server
First , logon to the git server by “ssh username@example.org”. username is the account name that can sudo or the user who knows root’s password to use su on the git server.
Then install gitos and git. On fedora system the command is like this:
$ sudo yum install git gitosis
or
$ su -c 'yum install git gitosis'
The command may be different on the other platforms.
Create server side git user and home
We need to create a Linux account for the shared account. It is usually git. But any account name can be used. The repositories are stored in git’s home directory.
Logon to the git server by ssh username@example.org. username is the account name that can sudo or the one that knows root’s password on the git server.
$ sudo useradd -m -d /home/git -u 1005 git
Here we assume git’s home directory is /home/git.
Setup gitosis management repository
First create the administrator’s SSH public key if you haven’t got one. On the administrator’s local machine:
$ ssh-keygen -t rsa
Then copy it to the git server’s /tmp/ directory:
$ scp ~/.ssh/id_rsa.pub username@example.org:/tmp/id_rsa.pub
Logon to the git server with account that has privilege to sudo or su. Then:
$ sudo su - git$ cd$ gitosis-init < /tmp/id_rsa.pub
Now we have created the gitosis administration repository on git server. The default repository directory is ~/repositories/ under git’s home directory.
Then the administrator can get the gitosis-admin repository from the git server on local machine:
$ git clone git@example.org:gitosis-admin.git
There are one configuration file and one directory in gitosis-admin:
gitosis.conf keydir
gitosis.conf is the configuration file for gitosis. keydir is used to store the users’ public SSH keys. These files are used to manage repositories and users by the administrator. A git server has been set up by now. Management work can be done by editing the files in the gitosis-admin repository and pushing it to the git server.
Public access
We may want to give everyone read-only access to a public project without using SSH keys. We can use git-daemon. It is a daemon tool independent of gitosis and it comes with git itself.
First logon to the git server as privileged user, and then use this command to export all the repositories to public users.:
$ sudo -u git git-daemon --base-path=/home/git/repositories/ --export-all
Someone can then clone repository example.git like this:
$ git clone git://example.org/example.git
If we only want to export selected repositories, we should remove “–export-all” from the above command. Then if we want to export example.git to the others, we need to logon the git server (privileged account is needed) and go to the repository’s directory (/home/git/repositories/example.git for this example). Then create a file named git-daemon-export-ok:
$ touch git-daemon-export-ok
Then this repository is exported to the public now, while the others are keep private.
- Setting Up Git Server Using Gitosis
- Setting up Git on CentOS 5 server
- Setting up a git server on MacOS X Lion
- Setting up VPN using Htun
- Linux 使用 Gitosis 架設 Git Server
- Setting up a new remote git repository
- Setting Up Git Commit Email Notifications
- setting up a new remote git repository
- Git Gitosis
- Git Gitosis
- GIT server build up
- Setting Up a Telnet Server in Ubuntu
- Setting up Telnet server on Ubuntu
- setting up central mercurial server in ubuntu
- Setting Up an Ubuntu Subversion Server
- Setting up NFS on Ubuntu 10.04 Server
- Setting Up a Simple OCR Server
- Setting Up a Fake SMTP Server
- 学习Objective-C:入门手册
- android编译系统makefile(Android.mk)写法
- 赏心悦目的宏代码
- 自己写的一个JS表格分页代码第一版
- Android 之 ServiceManager与服务管理
- Setting Up Git Server Using Gitosis
- objective-c中的Singleton单例模式的完整实现示例
- email验证
- 用Java调用存储过程
- java 获取当前路径
- Ubuntu Telnet服务器与SSH服务器的配置
- java.lang.Comparable 接口
- 不安装Oracle客户端远程连接Orcale数据库
- TI文件系统制作,和在线烧写与更新