Git服务安装

准备环境IP主机名192.168.47.126git1192.168.47.125git2需求下载源码包编译安装或者yum安装服务端创建git用户,配置空仓库创建无秘钥登录证书客户端命令使用:克隆、修改git配置、 添加修改文件到暂存区、 提交修改到本地仓库、 提交修改到远程服务器。1.yum安装git[root@git1 ~]# yum -y i...
摘要由CSDN通过智能技术生成

准备环境

IP 主机名
192.168.47.126 server
192.168.47.125 client

需求
下载源码包编译安装或者yum安装
服务端创建git用户,配置空仓库
创建无秘钥登录证书
客户端命令使用:克隆、修改git配置、 添加修改文件到暂存区、 提交修改到本地仓库、 提交修改到远程服务器。
1.yum安装git

yum -y install git

2.创建git用户

[root@server  ~]# useradd -m git
[root@server  ~]# passwd git
Changing password for user git.
New password: 
BAD PASSWORD: The password is a palindrome
Retype new password: 
passwd: all authentication tokens updated successfully.

3.创建空仓库

[root@server  ~]# su - git
[git@server  ~]$ mkdir project.git
[git@server  ~]$ cd project.git/
[git@server project.git]$ git init --bare
Initialized empty Git repository in /home/git/project.git/

4.仓库文件授权

[git@server project.git]$ chown -R git:git /home/git/project.git/

5.客户端访问方式

[root@server ~]# git clone file:///home/git/project.git/
Cloning into 'project'...
warning: You appear to have cloned an empty repository.

[root@client ~]# git clone git@192.168.47.126:/home/git/project.git
Cloning into 'project'...
The authenticity of host '192.168.47.126 (192.168.47.126)' can't be established.
ECDSA key fingerprint is 85:fd:a6:6f:4a:35:f3:9f:14:d9:1c:97:44:db:a3:f9.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.47.126' (ECDSA) to the list of known hosts.
git@192.168.47.126's password: 
warning: You appear to have cloned an empty repository.

6.创建无密钥登陆证书
(服务端、客户端都要执行)

[root@server ~]# su - git
[git@server ~]$ ll
total 0
[git@server ~]$ pwd
/home/git
[git@server ~]$ ssh
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值