If you use a small number of git, you can use the following steps to quickly deploy a git server environment. For example, as I am now the situation to two people on assignment to Qita company to do projects, but to do something that is completely independent of the time in addition to the integration of other projects with the company code group interaction, and usually can not be free to interact with the code, alas, shit’s security, other times on my two visits.
SSH public key generation
Each need to use git server engineers, they need to generate a ssh public key into your ~ /. Ssh directory to see if a file name and file name to use. Pub named after a pair of files, the file name is usually id_dsa or id_rsa . . Pub is the public key file, another file is key. Without these files (or simply connected. Ssh directory are not), you can use the program ssh-keygen to create them, the program in the Linux / Mac systems provided by the SSH package in Windows, is included in MSysGit bag:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/schacon/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/schacon/.ssh/id_rsa.
Your public key has been saved in /Users/schacon/.ssh/id_rsa.pub.
The key fingerprint is:
43:c5:5b:5f:b1:f1:50:43:ad:20:a6:92:6a:1f:9a:3a schacon@agadorlaptop.local
It first asks you to confirm the position of saving the public key (.ssh / id_rsa), then it will let you repeat a password twice, if you do not want to enter a password when using the public key can be left blank.
Now, all users have done this step had to put their public key to your server administrator or Git (assuming the service is configured to use SSH public key mechanism). They only need to copy. Pub file contents and then e-email it. The way the public key as follows:
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3 Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx NrRFi9wrf+M7Q== test@agadorlaptop.local
Set up the server
First, create a ‘git’ user and to create a. Ssh directory in the user home directory:
$ sudo adduser git
$ su git
$ cd
$ mkdir .ssh
Next, the developer of the SSH public key added to the user’s authorized_keys file. Suppose you received via e-mail co-existence of several public key to a temporary file. Authorized_keys file as long as they are added
$ cat /tmp/id_rsa.curtis.pub >> ~/.ssh/authorized_keys
$ cat /tmp/id_rsa.dylan.pub >> ~/.ssh/authorized_keys
Now you can use the-bare option to run git init to set an empty warehouse, which will initialize a repository does not contain a working directory.
$ cd /opt/git
$ mkdir project.git
$ cd project.git
$ git –bare init
At this time, developers can add it to remote storage, push a branch to the first version of the project was uploaded to the warehouse. It should be noted that every time you add a new project requires the host through the shell login and create a pure warehouse. We may wish to gitserver as the git user and the warehouse where the host name. If you run the host within the network, and set gitserver in the DNS to point the host, then the following commands are available.
$ cd myproject
$ git init
$ git add .
$ git commit -m ‘initial commit’
$ git remote add origin git@gitserver:/opt/git/project.git
$ git push origin master
Thus, cloning and push other people the same become very simple:
$ git clone git@gitserver:/opt/git/project.git
$ vim README
$ git commit -am ‘fix for the README file’
$ git push origin master
Using this method can be very quick to set up a small number of developers can read and write Git services.
As an extra precaution, you can use Git comes with a simple tool to git-shell git users to limit the activities associated only with Git. Make it git user login shell, then the user can not have a normal shell access to the host. To achieve this, the need to specify the user’s login shell is a git-shell, rather than bash or csh. You may have to edit / etc / passwd file
$ sudo vim /etc/passwd
In the end of the file, you should be able to find the line like this:
git:x:1000:1000::/home/git:/bin/sh
The bin / sh to / usr / bin / git-shell (or, which git-shell to see its location). Modified the way the bank is as follows:
git:x:1000:1000::/home/git:/usr/bin/git-shell
Now git user can only use SSH connection to push and get Git repository, and can not directly use the host shell. Try to log on, you will see the following information about this rejection:
$ ssh git@gitserver
fatal: What do you think I am? A shell?
Connection to gitserver closed.
via: http://www.codeweblog.com/git-server-group-level-structures/
相关推荐
Git使用教程
日活千万级公司git使用规格。 目的 1 开发人员 git 使用流程(规范) 2 提交规范 2 分支建立规范 4 新功能开发分支建立规范 4 发布规范 4
git使用的详细操作步骤 git使用的详细操作步骤git使用的详细操作步骤git使用的详细操作步骤git使用的详细操作步骤git使用的详细操作步骤git使用的详细操作步骤git使用的详细操作步骤
git使用培训手册
Git使用手册中文版,详细介绍了Git的相关信息
Git使用介绍及高级技巧 Git Magic.pdf
简单直接的GIT使用入门教程,篇幅短小,没那么多废话。
比较详细的git 使用手册 ...............
git使用视频教程,带你一步步学会git的使用,安装、提交代码、解决冲突等等!
git使用说明超级详细的总结分类,使用mindManager完成资源分类
Git使用规范及部分代码规范.pdf
GIT使用教程[收集].pdf
git的基本操作使用,希望对大家有用,这是部门同事分享的
版本管理工具Git的入门教程,较为详细,适合初学者阅读
MindMaster的emmx源格式,Git使用命令汇总, 简单明了的思维导图 内容: 初始化 SSH连接(Window) 本地操作 分支操作 远程操作
Git使用文档
git使用详细介绍
git 使用手册git 使用手册git 使用手册git 使用手册git 使用手册git 使用手册
此资源是Git官网的官方学习手册、指南,且是中文版,非常详细和明确,借此手册可以对Git从入门到深入进行系统的学习,墙裂推荐!Git的代码托管功能远强于svn,可以说是开发必备技能之一。官网下载很慢,所以此处提供...
Git开发操作流程v1.0 Git使用笔记 目录: Git开发操作流程 2 1. 新建分支 2 # 1-查看当前git状态 2 # 2-若不在主分支master,则切换至主分支 2 # 3-更新主干代码,确保本地仓库与远程同步 2 # 5-推送至远程仓库 2 2. ...