Linux 搭建Git服务器的方法
更新时间:2018年05月03日 09:06:01 作者:后除
本篇文章主要介绍了Linux 搭建Git服务器的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
安装Git
yum install -y git git --version
创建 Git 用户
sudo adduser git // 设置密码 passwd git
导入公钥
find / -name authorized_keys vim /root/.ssh/authorized_keys
创建Git仓库
# 切到指定目录下 sudo git init --bare server.git # owner指定为git sudo chown -R git:git server.git
禁用git用户Shell
在 /etc/passwd 文件里把 git:x:502:502::/home/git:/bin/bash 改为 git:x:502:502::/home/git:/usr/bin/git-shell
clone代码到本地
git clone git@127.0.0.1:/web/mazey.cn/server/server.git
注意
若 git push 的出现权限问题:
fatal: Unable to create temporary file: Permission denied fatal: sha1 file '<stdout>' write error: Broken pipe error: failed to push some refs to 'git@0.0.0.0:/web/mazey.cn/server/server.git'
执行如下命令:
sudo chown -R git:git /web/mazey.cn/server/
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
相关文章
Linux服务器VPS的Windows DD包详细的制作教程
这里就说下Windows dd包的制作过程,虽然网上很多这样的dd包,但对于一些来历不明的,也会有点不放心,所以我们有时间的话可以自己定制一个2022-08-08
Apache Doris的Bitmap索引和BloomFilter索引使用及注意事项
bitmap index是一种位图索引,是一种快速数据结构,能够加快查询速度,BloomFilter索引也是以Block为粒度创建的,这篇文章主要介绍了Apache Doris的Bitmap索引和BloomFilter索引使用,需要的朋友可以参考下2022-09-09
Apache Pulsar 微信大流量实时推荐场景下实践详解
这篇文章主要为大家介绍了Apache Pulsar 微信大流量实时推荐场景下实践详解,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪2022-11-11


最新评论