(注意和平时使用git创建项目以及项目管控的区别)
环境:centos7
(要求: 有root权限, 以下操作全部在root权限下执行)
1. 安装git : yum install git
2. 创建用户: adduser git(用户名可以任意取, 但是一定要创建用户)
3. 检验是否成功: id git (若有东西输出, 表明创建成功)
4. git init --bare test.git
特别说明:
(初始化仓库, 类似github上的 git clone https://github.com/Faithlmy/c.git 中的 c.git。
这句话不能在/root下执行,否则 执行git clone 的时候回报错
fatal: '/root/data/git/gittest.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.)
5. 把创建的test.git 的权限改为 刚创建的git用户:
chown -R git : git test.git
此时git服务器已经搭建 成功,测试方法:
git clone git@服务器地址:/home/test.git
若git clone失败请检查git的使用中的git秘钥配置等问题

本文介绍如何在CentOS7环境下使用root权限搭建Git服务器,包括安装Git、创建用户及初始化仓库等步骤,并提供了测试服务器搭建成功的方法。
2751

被折叠的 条评论
为什么被折叠?



