Centos上搭建git服務

2022-07-30 05:15:11 字數 1115 閱讀 8654

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

$ yum install git

接下來我們 建立乙個git使用者組和使用者,用來執行git服務:

$ groupadd git

$ adduser git -g git

收集所有需要登入的使用者的公鑰,公鑰位於id_rsa.pub檔案中,把我們的公鑰匯入到/home/git/.ssh/authorized_keys檔案裡,一行乙個。

如果沒有該檔案建立它:

$ cd /home/git/$ mkdir .ssh

$ chmod 700.ssh

$ touch .ssh/authorized_keys

$ chmod 600.ssh/authorized_keys

首先我們選定乙個目錄作為git倉庫,假定是/home/gitrepo/runoob.git,在/home/gitrepo目錄下輸入命令:

$ cd /home

$ mkdir gitrepo

$ chown git:git gitrepo/$ cd gitrepo

$ git init --bare runoob.git

initializedempty gitrepository in/home/gitrepo/runoob.git/

以上命令git建立乙個空倉庫,伺服器上的git倉庫通常都以.git結尾。然後,把倉庫所屬使用者改為git:

$ chown -r git:git runoob.git

$ git clone [email protected]:/home/gitrepo/runoob.git

192.168.45.4 為 git 所在伺服器 ip ,你需要將其修改為你自己的 git 服務 ip。

git:x:503:503::/home/git:/bin/bash

改為:

git:x:503:503::/home/git:/sbin/nologin

CentOs上搭建git伺服器

centos上搭建git伺服器 首先安裝setuptools wget tar zxvf setuptools 0.6c11.tar.gz cd setuptools 0.6c11 python setup.py build python setup.py install 在伺服器 centos 上...

CentOs上搭建git伺服器

原文 首先安裝setuptools wget tar zxvf setuptools 0.6c11.tar.gz cd setuptools 0.6c11 python setup.py build python setup.py install 在伺服器 centos 上首先安裝git軟體 安裝g...

centos搭建git服務

上一章節中我們遠端倉庫使用了 github,github 公開的專案是免費的,但是如果你不想讓其他人看到你的專案就需要收費。這時我們就需要自己搭建一台git伺服器作為私有倉庫使用。接下來我們將以 centos 為例搭建 git 伺服器。yum install curl devel expat dev...