Linux下搭建本地git服务器

本文介绍的方法基于linux系统已经安装完成git软件的前提下。

1.创建本地git仓库目录

root@zsup:/root# cd /
root@zsup:/# mkdir gitReport.git

2.增加git用户,该步骤可以省略,用自己的git账户也行。

root@zsup:/# useradd git
root@zsup:/# passwd git
新的 密码:
重新输入新的 密码:
passwd:已成功更新密码

3.初始化git仓库

root@zsup:/# git init --bare gitReport.git
已初始化空的 Git 仓库于 /gitReport.git/

4.把git仓库的的owner修改为git

root@zsup:/# chown -R git:git gitReport.git/

5.使用刚创建的git仓库

root@zsup:/home/share/QtPro/pro_bak# git clone git@127.0.0.1:/gitReport.git
正克隆到 'gitReport'...
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:dqoVsSb2/8doMEjy/F3nEarCu32uNNrhsHCibNSUQ4w.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts.
git@127.0.0.1's password:
Could not chdir to home directory /home/git: No such file or directory
warning: 您似乎克隆了一个空仓库。

root@zsup:/home/share/QtPro/pro_bak/gitReport# git add *
root@zsup:/home/share/QtPro/pro_bak/gitReport# git status
位于分支 master

尚无提交
root@zsup:/home/share/QtPro/pro_bak/gitReport# git commit -m "第一次提交"

*** 请告诉我您是谁。

运行

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"
设置您账号的缺省身份标识。
如果仅在本仓库设置身份标识,则省略 --global 参数。

fatal: 无法自动探测邮件地址(得到 'root@zsup.(none)')
root@zsup:/home/share/QtPro/pro_bak/gitReport# git config --global user.email "20331xxxxxx.@qq.com"
root@zsup:/home/share/QtPro/pro_bak/gitReport# git config --global user.name "git"
root@zsup:/home/share/QtPro/pro_bak/gitReport# git commit -m "第一次提交"
[master (根提交) 721926a] 第一次提交
 1277 files changed, 80008 insertions(+)

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Liu-Eleven

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

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

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

打赏作者

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

抵扣说明:

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

余额充值