栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Git 分布式版本控制

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Git 分布式版本控制

文章目录
  • Git 分布式版本控制
    • 一、版本控制概念
    • 二、Git简介
    • 三、Git部署
        • ①、环境
        • ②、安装依赖
        • ③、安装邮箱程序
        • ④、配置Yum安装
        • ⑤、自动配置文件
    • 四、Git使用
      • 1、Web使用
        • ①、查询密码登录
        • ②、添加ssh秘钥
        • ③、创建项目
        • ④、上传测试
        • ⑤、下载测试
      • 2、命令行使用
        • ①、域名解析
        • ②、克隆文件
        • ③、上传文件


Git 分布式版本控制 一、版本控制概念

记录开发文件的时间机器,挽回代码错误带来的损失

分类:本地版本控制系统、集中化的版本控制系统(SVN)、分布式版本控制系统GIT

二、Git简介

github公共的服务器

gitlab私有的git web服务器

官网链接 :https://about.gitlab.cn/install/#centos7

三、Git部署 ①、环境

一台4G以上内存Centos7主机

修改主机名 localhost

             IP                                 Role
       192.168.116.131                     localhost/gitlab
②、安装依赖
# yum install curl policycoreutils openssh-server openssh-clients
# systemctl enable sshd && systemctl start sshd
③、安装邮箱程序
# yum install postfix
# systemctl enable postfix && systemctl start postfix
④、配置Yum安装
# curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
# yum makecache
# yum -y install gitlab-ce
⑤、自动配置文件
# gitlab-ctl reconfigure
四、Git使用 1、Web使用 ①、查询密码登录
# cat /etc/gitlab/initial_root_password

username:root

​ http://192.168.116.131

②、添加ssh秘钥
# ssh-keygen
# cat /root/.ssh/id_rsa.pub

③、创建项目

④、上传测试

⑤、下载测试

2、命令行使用 ①、域名解析
# vim  /etc/hosts

192.168.116.131   gitlab.example.com
②、克隆文件
# git config --global user.name "git"
# git config --global user.email "git@localhost"
# git clone git@gitlab.example.com:gitlab-instance-f6b68889/git-1.git
③、上传文件
# cd git-1/                            # 进入工作目录
# git init                             # 初始化
# git remote add origin git@gitlab.example.com:gitlab-instance-f6b68889/git-1.git  # 配置远程服务器地址
# git add .                            # 当前目录文件
# git commit -m 'my-test'              # 提交上传说明
# git push -u origin main              # 上传文件

注:如果远程服务器配置报错,因为之前已经配置过其他远程服务器。

用命令清除掉:git remote rm origin

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/939181.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号