repository management
来源:互联网 发布:相机照片数据恢复 编辑:程序博客网 时间:2024/04/28 12:17
Git repositories are stored in git.gromacs.org:/home/git/repositories. Access to them is controlled by gitosis. It provides a convenient, centralized way to add members and create groups with write access to different projects. It utilizes a single user, git in the current installation, to access all repositories, while different developers are authenticated by their public keys. There is no need to create a user account for each developer.
The configuration files of gitosis reside as a ceparate git repository, gitosis-admin, on the same server. Modification of the settings is done by checking-out (cloning) the repository on your personal machine (or in your home directory on gromacs), modifying the files, and uploading (pushing) the changes back to the server.
All administration of the repositories, including gitosis-admin, should be done remotely via git, by cloning a local copy and uploading the changes. Do not edit directly the files on the server.
Gitosis-admin repository
peter# git clone git@git.gromacs.org:gitosis-admin.gitpeter# cd gitosis-admin.git
Peter has to be a member of a group with write permissions to the gitosis-admin.git repository. See below for details.
The git-daemon
Public access to the repositories is granted by the git-daemon. Parameters passed to the daemon can be modified by editing /etc/sv/git-daemon/run and restarting the daemon:
root@git.gromacs.org# cat /etc/sv/git-daemon/run#!/bin/shexec 2>&1echo 'git daemon starting.'exec chpst -ugitdaemon:git git daemon --verbose --base-path=/home/git/repositories --user-path=public_gitroot@git.gromacs.org# sv restart git-daemon
"--base-path" specifies the location of the repositories, while an "--export-all" flag would give all git repositories public access. The daemon distinguishes between git repositories and regular directories. If you want to grant public access only to a selection of repositories, then remove the --export-all option of the daemon parameter, and create and empty file namedgit-daemon-export-ok in the said repositories, or, since we are using gitosis for administration, the correct way to do it is by adding the following to the gitosis.conf file:
[repo gromacs]daemon = yes
Here, gromacs is the name of the repository to which we want to grant public access. If this option is not passed, then the git-daemon-export-ok file will be removed after the gitosis-admin.git repository is updated again.
Adding a new developer to existing repository
Simply put the public key of the developer in the keydir directory in gitosis-admin.git, and add his/her name to the list of group members. Tell git to add the new file for upload and commit the changes. For example, add Joe as a gromacs developer, i.e. give him write access to the gromacs.git repository:
// Joe's key has to be named joe.pubpeter@local:/home/peter/dev# cp /tmp/joe.pub keydir// Add Joe to the corresponding project grouppeter@local:/home/peter/dev/gitosis-admin.git# cat gitosis.conf[gitosis][group gitosis-admin]writable = gitosis-adminmembers = peter[group gmx]members = peter joewritable = gromacs// Tell git we have created a new file for inclusionpeter@local:/home/peter/dev/gitosis-admin.git# git add keydir/joe.pub// Commit the changes to the local repository (see the git documentation links below)peter@local:/home/peter/dev/gitosis-admin.git# git commit -a -m "Added Joe to the gromacs developers"Created commit 7513ce4: Added Joe 1 files changed, 1 insertions(+), 1 deletions(-) create mode 100644 keydir/joe.pub//Upload the changes to the remotepeter@local:/home/peter/dev/gitosis-admin.git# git push
Now Joe and Peter have write access to the gromacs.git repository, but only Peter can administer the gitosis-admin.git one. Note that in the configuration file gitosis.conf the names of the developers, peter and joe, should be the same as the names of their public keys, without the .pub extension. Also, the names of the repositories, for example gromacs, do not include the extension .git.
Creating a new project repository
Add the name of the new repository to the "writable = ..." list of the developer groups (or make a new group). Note that the directory containing the project will be automatically created at a later point, after the first "push" (see below). For example, to start a new project MyProject, Peter who is a member of the gitosis-admin group, edits gitosis.conf and adds myproject as the name of the new project repository which both Peter and Joe can work with:
peter@local:/home/peter/dev/gitosis-admin# cat gitosis.conf[gitosis][group gitosis-admin]writable = gitosis-adminmembers = peter[group dev-src]members = peter joewritable = gromacs myproject// Commit the changes locally ...peter@local:/home/peter/dev/gitosis-admin# git commit -a -m "Added a MyProject repository."Created commit d2c3702: Added a MyProject repository. 1 files changed, 1 insertions(+), 1 deletions(-)// ... and then to the serverpeter@local:/home/peter/dev/gitosis-admin# git pushCounting objects: 5, done.Compressing objects: 100% (3/3), done.Writing objects: 100% (3/3), 338 bytes, done.Total 3 (delta 1), reused 0 (delta 0)To git@git.gromacs.org:gitosis-admin.git 776b9f9..d2c3702 master -> master
Even though Peter has created a new repository, at this point there is nothing to be found about it in git.gromacs.org:/home/git/repositories beacuse nothing has been "pushed" to it. To do that, Peter creates a new project directory for the MyProject project (or use an already existing structure, cvs-import etc.), does development work and uploads to the server:
peter@local:/home/peter/dev$ mkdir myprojectpeter@local:/home/peter/dev$ cd myproject/peter@local:/home/peter/dev/myproject$ git initInitialized empty Git repository in /home/rossen/Desktop/dev/myproject/.git/peter@local:/home/peter/dev/myproject$ git remote add myproject git@git.gromacs.org:myproject.gitpeter@local:/home/peter/dev/myproject$ touch file1peter@local:/home/peter/dev/myproject$ git add file1// Commit to the local repository copypeter@local:/home/peter/dev/myproject$ git commit -a -m "Added new file1."Created initial commit c518b17: Added new file1. 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 file1// Upload to the serverpeter@local:/home/peter/dev/myproject$ git push myproject master:refs/heads/masterInitialized empty Git repository in /home/git/repositories/myproject.git/Counting objects: 3, done.Writing objects: 100% (3/3), 223 bytes, done.Total 3 (delta 0), reused 0 (delta 0)To git@git.gromacs.org:myproject.git * [new branch] master -> master
Now the myproject.git directory is created on the server:
root@git.gromacs.org:/home/git/repositories# ls myproject.gitbranches config description HEAD hooks info objects refs
In order to give anonymous users read access to the new repository add the following to gitosis.conf and commit/push:
[repo myproject]daemon = yes
Renaming a repository
- Rename the name of the repository in gitosis.conf (from a locally fetched copy of the gitosis-admin repository), commit and push the change through git.
- Rename the name of the repository on the server (you need to be root).
Deleting a repository
- Remove the name of the repository from gitosis.conf (see above).
- Remove (as root) the .git directory on the server.
- repository management
- MGMTDB: Grid Infrastructure Management Repository
- Essential CVS/CVS Administration/Repository Management
- Repository
- Repository
- Repository
- Repository
- FAQ: 12c Grid Infrastructure Management Repository (GIMR) (文档 ID 1568402.1)
- Sentences repository
- Repository模式
- Repository模式
- maven repository
- Repository模式
- Repository 模式
- Repository模式
- Repository 模式
- Repository Pattern
- Repository Pattern
- RFC文档中文索引(zt)
- 预测实现某个业务的条件是否成熟
- VC MFC 窗口最大化、最小化所触发的事件
- Unable to build: the file dx.jar was not loaded from the SDK folder!
- delphi 把一个ICO转换为BMP
- repository management
- linux下mysql安装
- 在串口通讯程序中处理数据包
- EXTJS 菜单的综合例子
- 使用InvalidateRect(rect) 防止图片移动时发生闪烁
- 开发者应知的 如何“推销自己”?
- RDLC 报表项消失
- SendMessage 和 PostMessage的用法!
- 将DataTable转换为List的好处与实现方法