Git 构建分布式版本控制系统

github:

公共的服务器
GitHub注册
https://guides.github.com/activities/hello-world/


1.生成本地ssh key
ssh-keygen -t rsa -C 'git@github.com'    邮箱要与github上注册的相同


2.复制 公钥,在github 中添加ssh key
cat .ssh/id_rsa.pub   复制所有
在github找到账户设置 settings(右上角)
选择ssh key    
ssh and gpg keys     选择new ssh key


3.测试本地客户端   yum install git


4.进行认证(但不能远程连接)
ssh -T git@github.com


5.在本地添加远程仓库用户名
git config --global user.name 'liuyijingcloud'


6.在本地添加远程仓库邮箱
git config --global user.email '邮箱@163.com'


7.启用默认的颜色设置
git config --global color.ui true
不喜欢花花绿绿的就关了。git config --global color.ui false


8.查看配置
git config --list
 ls .gitconfig
cat .gitconfig 


9.连接远程仓库
git remote -v


10.设置远程仓库地址
 git remote add origin git@github.com:liuyijingcloud/liuyijing001.git


11.克隆远程仓库信息
 git clone git@github.com:liuyijingcloud/liuyijing001.git
 ls                   cd liuyijing001/                      ls


12.上传文件  
echo 44444444  >  00000.sh   新建文件
git init   初始化
git remote add origin git@github.com:liuyijingcloud/liuyijing001.git  配置远程服务器地址
如果远程服务器配置报错,因为之前已经配置过其他远程服务器。

可以用命令清除掉  git remote rm origin 
git add .     建立当前文件夹下所有的文件,为准备上传的文件
git commit    
提交上传说明    git commit -m 'first commit'
git push -u origin master   上传

gitlab

私有的git   web服务器

1,安装和配置必要的依赖关系

 yum install curl policycoreutils openssh-server openssh-clients

2,开机自启动ssh程序      systemctl enable sshd

3, systemctl start sshd


4,安装邮件程序     yum install postfix

5,systemctl enable postfix
   systemctl start postfix
   systemctl stop firewalld  防火墙关上!   
   sudo systemctl disable firewalld

6,下载gitlab并安装

yum -y install gitlab-ce-9.1.0-ce.0.el7.x86_64.rpm
gitlab-ctl reconfigure    自动配置文件权限,安装数据库….

安装的时间会很长。


7,登录gitlab服务器

gitlab服务器的地址:http://192.168.184.145  
GITLAB占用80端口,访问时直接访问IP就可以
(第一次会让你确认root账户登录的密码)


登录以后    创建8位新密码  然后使用root登录即可
然后gitlab就创建完成了

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值