zoukankan      html  css  js  c++  java
  • Git-Runoob:Git 服务器搭建

    ylbtech-Git-Runoob:Git 服务器搭建
    1.返回顶部
    1、

    Git 服务器搭建

    上一章节中我们远程仓库使用了 Github,Github 公开的项目是免费的,但是如果你不想让其他人看到你的项目就需要收费。

    这时我们就需要自己搭建一台Git服务器作为私有仓库使用

    接下来我们将以 Centos 为例搭建 Git 服务器。

    1、安装Git

    $ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel
    $ yum install git

    接下来我们 创建一个git用户组和用户,用来运行git服务:

    $ groupadd git
    $ useradd git -g git

    2、创建证书登录

    收集所有需要登录的用户的公钥,公钥位于id_rsa.pub文件中,把我们的公钥导入到/home/git/.ssh/authorized_keys文件里,一行一个。

    如果没有该文件创建它:

    $ cd /home/git/
    $ mkdir .ssh
    $ chmod 755 .ssh
    $ touch .ssh/authorized_keys
    $ chmod 644 .ssh/authorized_keys

    3、初始化Git仓库

    首先我们选定一个目录作为Git仓库,假定是/home/gitrepo/runoob.git,在/home/gitrepo目录下输入命令:

    $ cd /home
    $ mkdir gitrepo
    $ chown git:git gitrepo/
    $ cd gitrepo
    
    $ git init --bare runoob.git
    Initialized empty Git repository in /home/gitrepo/runoob.git/

    以上命令Git创建一个空仓库,服务器上的Git仓库通常都以.git结尾。然后,把仓库所属用户改为git:

    $ chown -R git:git runoob.git

    4、克隆仓库

    $ git clone git@192.168.45.4:/home/gitrepo/runoob.git
    Cloning into 'runoob'...
    warning: You appear to have cloned an empty repository.
    Checking connectivity... done.

    192.168.45.4 为 Git 所在服务器 ip ,你需要将其修改为你自己的 Git 服务 ip。

    这样我们的 Git 服务器安装就完成。

    2、
    2.返回顶部
     
    3.返回顶部
     
    4.返回顶部
     
    5.返回顶部
    1、
    2、
     
    6.返回顶部
     
    warn 作者:ylbtech
    出处:http://ylbtech.cnblogs.com/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    [Leetcode] Rotate Image
    [Leetcode] Permutation Sequence
    [Leetcode] Palindrome Partitioning
    [Leetcode] Letter Combinations of a Phone Number
    Java里的多线程
    css学习2----css动态菜单
    css学习1----css超链接效果
    javascript判断身份证是否合法
    RMI(Remote Method Invocation,远程方法调用)
    struts.properties配置详解
  • 原文地址:https://www.cnblogs.com/storebook/p/11718582.html
Copyright © 2011-2022 走看看