使用Git与GitHub协同开发并搭建私有GitLab代码托管(5)

niko@niko-notebook:~$ git init StudyGitHub
Initialized empty Git repository in /home/niko/StudyGitHub/.git/
niko@niko-notebook:~$ cd StudyGitHub/
niko@niko-notebook:~/StudyGitHub$ git pull https://github.com/xv-niko/StudyGit.git
niko@niko-notebook:~/StudyGitHub$ git remote add origin https://github.com/xv-niko/StudyGit.git
niko@niko-notebook:~/StudyGitHub$ ls
file.txt  file2.txt  file3.txt
niko@niko-notebook:~/StudyGitHub$ echo "Desgin by B" >> file3.txt
niko@niko-notebook:~/StudyGitHub$ git add .
niko@niko-notebook:~/StudyGitHub$ git commit -m "add code"
[master 09003b9] add code
1 file changed, 1 insertion(+)
niko@niko-notebook:~/StudyGitHub$ git push origin master
Username for 'https://github.com': xv-niko
Password for 'https://xv-niko@github.com':
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 274 bytes | 68.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/xv-niko/StudyGit.git
 cbd7ce1..09003b9  master -> master

发起pull requests

使用Git与GitHub协同开发并搭建私有GitLab代码托管服务器

使用Git与GitHub协同开发并搭建私有GitLab代码托管服务器

使用Git与GitHub协同开发并搭建私有GitLab代码托管服务器

项目所有者团队查看请求

使用Git与GitHub协同开发并搭建私有GitLab代码托管服务器

合并代码

使用Git与GitHub协同开发并搭建私有GitLab代码托管服务器

所有者团队合并到本地

niko@niko-notebook:~/StudyGitHub$ cd ../StudyGit
niko@niko-notebook:~/StudyGit$ git pull origin master
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 4 (delta 2), reused 3 (delta 2), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/xvGe/StudyGit
* branch            master    -> FETCH_HEAD
 cbd7ce1..0ca0905  master    -> origin/master
Updating cbd7ce1..0ca0905
Fast-forward
file3.txt | 1 +
1 file changed, 1 insertion(+)
niko@niko-notebook:~/StudyGit$ cat file3.txt
Hi, FullStackDev.
fix this bug by xvge.
add feature by master.
Desgin by B

Git工作流

集中式工作流

Git Flow(常用)

使用Git与GitHub协同开发并搭建私有GitLab代码托管服务器

Forking工作流

部署GitLab代码托管服务器

yum clean all && yum repolist all
yum install -y curl policycoreutils-Python openssh-server
systemctl enable sshd
systemctl start sshd
firewall-cmd --permanent --add-service=http  # 如果开启了防火墙执行
systemctl reload firewalld                  # 如果开启了防火墙执行
yum install postfix -y
systemctl enable postfix
systemctl start postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce
gitlab-ctl reconfigure    # 配置服务器
gitlab-ctl start          # 启动服务器

访问服务器地址即可,GitLab服务器搭建指南:https://about.gitlab.com/installation/

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/31b852f376394eb7f474e4381529dd22.html