zoukankan      html  css  js  c++  java
  • ubuntu 14.04搭建git服务器

    想在单位内部署git服务器,因此,特别记录部署相关的安装步骤

    1.  安装

    root@ros-OptiPlex-3050:~# sudo apt-get install git
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Suggested packages:
      git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch
      git-cvs git-mediawiki git-svn
    The following NEW packages will be installed:
      git
    0 upgraded, 1 newly installed, 0 to remove and 179 not upgraded.
    Need to get 3,176 kB of archives.
    After this operation, 24.1 MB of additional disk space will be used.
    Get:1 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main amd64 git amd64 1:2.7.4-0ubuntu1.6 [3,176 kB]
    Fetched 3,176 kB in 7s (399 kB/s)                                                              
    Selecting previously unselected package git.
    (Reading database ... 258511 files and directories currently installed.)
    Preparing to unpack .../git_1%3a2.7.4-0ubuntu1.6_amd64.deb ...
    Unpacking git (1:2.7.4-0ubuntu1.6) ...
    Setting up git (1:2.7.4-0ubuntu1.6) ...
    2. 添加用户

    root@ros-OptiPlex-3050:~# sudo adduser git
    Adding user `git' ...
    Adding new group `git' (1003) ...
    Adding new user `git' (1003) with group `git' ...
    The home directory `/home/git' already exists.  Not copying from `/etc/skel'.
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully
    Changing the user information for git
    Enter the new value, or press ENTER for the default
        Full Name []:
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
    Is the information correct? [Y/n]
    root@ros-OptiPlex-3050:~# ll /home/git/
    total 32
    drwxr-xr-x 2 git  git  4096 7月  12 09:33 ./
    drwxr-xr-x 6 root root 4096 7月  12 09:33 ../
    -rw-r--r-- 1 git  git   220 7月  12 09:33 .bash_logout
    -rw-r--r-- 1 git  git  3771 7月  12 09:33 .bashrc
    -rw-r--r-- 1 git  git  8980 7月  12 09:33 examples.desktop
    -rw-r--r-- 1 git  git   655 7月  12 09:33 .profile
    3. 在/home/git目录下放置证书

    4. 初始化git库

    root@ros-OptiPlex-3050:/home/git#  git init --bare sample.git
    Initialized empty Git repository in /home/git/sample.git/
    root@ros-OptiPlex-3050:/home/git# ls
    examples.desktop  sample.git

    5. 禁用shell
    root@ros-OptiPlex-3050:/home/git# sudo chown -R git:git sample.git
    root@ros-OptiPlex-3050:/home/git# git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell
    -bash: git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell: No such file or directory
    6.其他

    • 要方便管理公钥,用Gitosis

    • 要像SVN那样变态地控制权限,用Gitolite

  • 相关阅读:
    OpenStack对象存储——Swift
    使用ssh对服务器进行登录
    在MacOs上配置Hadoop和Spark环境
    DOTA与面向对象的编程思想(3)——英雄的生命周期
    DOTA与面向对象的编程思想(2)——三层架构,让游戏跑起来
    DOTA与面向对象编程思想(1)——分述DOTA和面向对象思想
    再谈面向对象
    linux C 列出目录中的文件列表 包含文件的相关信息
    在Ubuntu 64位下搭建samba,实现linux与windows之间的资源共享,配置实现Ubuntu启动后samba服务与ssh服务开机自动启动
    LINUX下使用elasticsearch-jdbc工具实现MySQL同步到ElasticSearch 以及linux 64位centos系统安装jdk1.8
  • 原文地址:https://www.cnblogs.com/youran-he/p/11174315.html
Copyright © 2011-2022 走看看