一丶GitHub

账号信息

GitHub 首页就是注册页面:https://github.com/

岳不群的GitHub账号 Email 地址:[email protected] GitHub账号:[email protected]
令狐冲的GitHub账号 Email 地址:[email protected] GitHub账号:[email protected]
东方不败的GitHub账号 Email地址:[email protected] GitHub账号:[email protected]

创建远程库

GitHub操作简单说明

创建远程库地址别名

git remote -v 查看当前所有远程地址别名
git remote add [别名] [远程地址]
GitHub操作简单说明

推送

git push [别名] [分支名]
GitHub操作简单说明

克隆

命令:git origin [远程地址]
GitHub操作简单说明
效果:
完整的把远程库下载到本地
创建 origin 远程地址别名
初始化本地库

团队成员邀请

GitHub操作简单说明
InLett-CY用其他方式把邀请链接发送给“InLett-chen”,“InLett-chen”登录自己的GitHub账号,访问邀请链接。
GitHub操作简单说明

拉取

pull=fetch+merg
git fetch [远程库地址别名] [远程分支名]
git merge [远程库地址别名/远程分支名]
git pull [远程库地址别名] [远程分支名]

解决冲突

要点

如果不是基于 GitHub 远程库的最新版所做的修改,不能推送,必须先拉取。
拉取下来后如果进入冲突状态,则按照“分支冲突解决”操作解决即可。

类比

债权人:老王
债务人:小刘
老王说:10 天后归还。小刘接受,双方达成一致。
老王媳妇说:5天后归还。小刘不能接受。老王媳妇需要找老王确认后再执行。

跨团队协作

Fork
GitHub操作简单说明GitHub操作简单说明
本地修改,然后推送到远程
Pull Request
GitHub操作简单说明
GitHub操作简单说明
GitHub操作简单说明
对话

GitHub操作简单说明

审核代码
GitHub操作简单说明
合并代码

GitHub操作简单说明
将远程库修改拉取到本地
GitHub操作简单说明
GitHub操作简单说明

SSH登录

进入当前用户的家目录

$ cd ~

删除.ssh 目录

$ rm -rvf .ssh

运行命令生成.ssh **目录

$ ssh-****** -t rsa -C [email protected]
[注意:这里-C 这个参数是大写的C]

进入.ssh 目录查看文件列表

$ cd .ssh
$ ls -lF

查看 id_rsa.pub 文件内容

$ cat id_rsa.pub

复制 id_rsa.pub 文件内容

登录 GitHub,点击用户头像→Settings→SSH and GPG keys

New SSH Key

输入复制的**信息

回到 Git bash 创建远程地址别名

git remote add origin_ssh [email protected]:InLett-CY/huashan.git

推送文件进行测试

GitHub操作简单说明

二丶Gitlab 服务器搭建过程

官网地址

首页:https://about.gitlab.com/
安装说明:https://about.gitlab.com/installation/

安装命令摘录

sudo yum install -y curl policycoreutils-python openssh-server cronie
sudo lokkit -s http -s ssh
sudo yum install postfix
sudo service postfix start
sudo chkconfig postfix on
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
sudo EXTERNAL_URL=“http://gitlab.example.com” yum -y install gitlab-ee
实际问题:yum安装 gitlab-ee(或 ce)时,需要联网下载几百 M 的安装文件,非常耗时,所以应提前把所需 RPM 包下载并安装好。
下载地址为:

https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-10.8.2-ce.0.el7.x86_64.rpm

调整后的安装过程

sudo rpm -ivh /opt/gitlab-ce-10.8.2-ce.0.el7.x86_64.rpm
sudo yum install -y curl policycoreutils-python openssh-server cronie
sudo lokkit -s http -s ssh
sudo yum install postfix
sudo service postfix start
sudo chkconfig postfix on
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo EXTERNAL_URL=“http://gitlab.example.com” yum -y install gitlab-ce
当前步骤完成后重启。

gitlab 服务操作

初始化配置 gitlab

gitlab-ctl reconfigure

启动 gitlab 服务

gitlab-ctl start

停止 gitlab 服务

gitlab-ctl stop

浏览器访问

访问Linux服务器IP地址即可,如果想访问EXTERNAL_URL指定的域名还需要配置域名服务器或本地hosts文件。
初次登录时需要为gitlab的root用户设置密码。

相关文章: