有些时候我们既不想在网上开源,又不想付费保存,就想白嫖就可以搭建git私有服务器了🤭
远程仓库实际上和本地仓库没啥不同,纯粹为了7x24小时开机并交换大家的修改。。
我自己使用的是CentOS。
这里就安利一下git 在cenos安装步骤:
1、安装git服务环境准备(git是C语言开发的,我们要安装一下C语言的编译环境)
yum -y install curl curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel gcc cc
2、下载git-2.5.0.tar.gz移到linux
1)tar zxvf git-2.5.0.tar.gz (Linux 解压命令-zxvf 详解)
2)cd git-2.5.0
3)autoconf(我在这一步出现了命令没找到,貌似是系统缺少某些脚本执行器,参考https://blog.csdn.net/zh15732621679/article/details/80948815)
4)./configure
5)make
6)make install(不知道为啥我一干啥就错误,错误和解决方案请看)
- git --version 检查一下是否安装正常,可以显示版本号了
3、添加用户(git用户)
adduser -r -c 'git version control' -d /home/git -m git
此命令执行后会创建/home/git目录作为git用户的主目录。
(-m git添加一个用户名为git的账户)
4、设置新密码
passwd git

5、 查看用户

6、使用git用户,并创建我们上传的git仓库(git服务器)

然后我们就可以上传到私有git仓库了
ssh://git(git用户名)@ip地址/home/git/repos/future
在push时候提供一下之前创建的密码即可


根据错误提示,是因为git默认不支持push?导致分支冲突?
vim修改了一下仓库的config,添加了
[receive]
denyCurrentBranch = ignore
果然搞定了


当然这条链接 ssh://用户名@ip地址/仓库地址 也可以用来克隆拉取等待...(bash添加链接origin去掉ssh也可以)
网友评论