zoukankan      html  css  js  c++  java
  • Git服务器搭建及配置

    一、部署环境

    Server操作系统:CentOS release 6.7 (Final)

    内核版本:2.6.32-358.el6.x86_64

    git版本:1.9.0,源码下载地址如下

    https://code.google.com/archive/p/git-core/downloads

    二、安装及配置

    1、安装依赖包

    # yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel

    2、编译安装git

    # tar xf git-1.9.0.tar.gz

    # cd git-1.9.0

    # make prefix=/usr/local all

    # make prefix=/usr/local install

    查看git版本号:

    # git --version

    git version 1.9.0

    3、添加git用户

    # useradd -s /bin/git-shell -c 'git version control' git

    # mkdir /home/git/.ssh

    4、将客户端生成的秘钥上传到服务器上

    # ssh-keygen 一路回车,然后将~/.ssh/id_rsa.pub放到服务器上

    # scp ~/.ssh/id_rsa.pub root@192.168.1.203:/home/git/.ssh/authorized_keys

    将/etc/ssh/ssh_config文件以下注释去掉:

    RSAAuthentication yes

    PubkeyAuthentication yes

    AuthorizedKeysFile  .ssh/authorized_keys

    5、创建一个git的裸仓库

    # git init --bare fansik.git

    # chown -R git.git  /home/git/

    6、克隆远程仓库

    # git clone git@192.168.1.203:/home/git/fansik.git

    7、测试上传

    进入到fansik目录

    # vim fansik

    # git add fansik

    # git commit -m "fansik"

    # git push -u origin master

  • 相关阅读:
    Java 处理 iphone拍照后 图片EXIF属性翻转90度的方法
    spring boot文件上传、下载
    python dict.get()和dict['key']的区别
    python zip()
    Pythonn new-style class and old-style class
    mysql错误
    django 模板中url的处理
    python中isort的使用
    使用uWSGI部署django项目
    django处理静态文件
  • 原文地址:https://www.cnblogs.com/fansik/p/6070341.html
Copyright © 2011-2022 走看看