centos git gitolite安装笔记

export PATH=/home/git/bin:$PATH

echo PATH
git branch 查看本地分支
git branch -a 查看远程分支

git fetch 获取远程分支

git checkout -b <local_branch_name> 创建分支并切换

git push origin <local_branch_name>:<remote_branch_name> 创建远程分支


git checkout <local_branch_name> 分支并切换


git branch -d <local_branch_name> 删除分支

git clone -b src https://github.com/...

 

git archive --remote=test:test.git HEAD:path/to/directory test.txt | tar -x

git archive --remote=test:test.git HEAD test.txt

git archive --remote=test:test.git HEAD:path/to/directory test.txt | tar -x

git archive --remote=test:test.git HEAD test/test.txt | tar -x

 

 

$ yum install git

$ rm -rf /home/git 

$ mkdir /home/git 
$ useradd -d /home/git  git  
$ passwd git
$ chown -R git.git /home/git 


$ su git

$ cd ~

$ git clone git://github.com/sitaramc/gitolite 

$ mkdir -p /home/git/bin

$ gitolite/install -ln /home/git/bin

$ export PATH=/home/git/bin:$PATH
$ echo $PATH

./bin/gitolite setup -pk ~/root.pub (注:root.pub存放位置git用户名~/.ssh)

执行成功会示下面的初始化信息
Initialized empty Git repository in /home/git/repositories/gitolite-admin.git/
Initialized empty Git repository in /home/git/repositories/testing.git/

 SSH 的客户端配置文件 ~/.ssh/config 可以通过创建主机别名,在连接主机时,使用特定的公钥。
例如 ~/.ssh/config 文件中的下列配置:
  host server
  user git
  hostname 192.168.1.212
  port 22
  identityfile ~/.ssh/root

 

你可能感兴趣的:(centos)