Git服务器的搭建

Git服务器的搭建

1、 依赖环境

Git需要很多依赖环境:因此安装git需要先安装下列软件

[root@localhost ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel gcc-c++

2、安装git

上传git安装包或者在linux系统下载git

下载地址

https://github.com/git/git/releases

在linux系统下载git:

wget https://github.com/git/git/archive/v2.16.1.tar.gz

解压

[root@localhost ~]# tar -zxvf v2.16.1.tar.gz

3、编译安装

安装命令:(进入git解压目录)

[root@localhost git-2.16.1]# make prefix=/usr/local/git all
[root@localhost git-2.16.1]# make prefix=/usr/local/git install

4、查看git

[root@localhost git-2.16.1]# git --version

5、配置环境变量

[root@localhost git-2.16.1]# vi /etc/profile
在最后一行添加
export PATH=$PATH:/usr/local/git/bin

6、配置git

6.1设置用户名和email

[root@localhost git-2.16.1]# git config --global user.name "simba"
[root@localhost git-2.16.1]# git config --global user.email "simba1949t@outlook.com"

4、初始化仓库

初始化仓库,仓库名为 test.git

[git@localhost root]$ cd
[git@localhost ~]$ git init --bare test.git

始化空的 Git 仓库于 /root/git-2.16.1/test.git/

如图:

这里写图片描述

附录1 Download for Linux and Unix

It is easiest to install Git on Linux using the preferred package manager of your Linux distribution. If you prefer to build from source, you can find the tarballs on kernel.org.

Debian/Ubuntu

For the latest stable version for your release of Debian/Ubuntu

# apt-get install git

For Ubuntu, this PPA provides the latest stable upstream Git version

# add-apt-repository ppa:git-core/ppa
# apt update; apt install git

Fedora

# yum install git

(up to Fedora 21)

# dnf install git

(Fedora 22 and later)

Gentoo

# emerge --ask --verbose dev-vcs/git

Arch Linux

# pacman -S git

openSUSE

# zypper install git

Mageia

# urpmi git

Nix/NixOS

# nix-env -i git

FreeBSD

# pkg install git

Solaris 9/10/11 (OpenCSW)

# pkgutil -i git

Solaris 11 Express

# pkg install developer/versioning/git

OpenBSD

# pkg_add git

Alpine

$ apk add git

Red Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al.

RHEL and derivatives typically ship older versions of git. You can download a tarball and build from source, or use a 3rd-party repository such as the IUS Community Project to obtain a more recent version of git.

Slitaz

$ tazpkg get-install git
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Simba1949

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值