commit 72c1eca92e989dfc5b7fde30341319581bafb261
Author: wxin <15253413025@163.com>
Date: Wed Apr 23 13:06:49 2025 +0800
上传文件至 /
diff --git a/Gitlab-私有仓库.md b/Gitlab-私有仓库.md
new file mode 100644
index 0000000..4c33855
--- /dev/null
+++ b/Gitlab-私有仓库.md
@@ -0,0 +1,356 @@
+
Gitlab 私有仓库
+
+------
+
+## 一:Gitlab 部署
+
+### 1. 资源环境
+
+| 主机名 | IP地址 | 服务 |
+| :----: | :-------------: | :------: |
+| gitlab | 192.168.159.136 | gitab-ce |
+
+### 2. 环境部署
+
+修改主机名:
+
+```bash
+[root@git ~]# hostnamectl set-hostname gitlab
+```
+
+关闭防火墙和`selinux`
+
+```bash
+[root@gitlab ~]# systemctl stop firewalld
+[root@gitlab ~]# systemctl disable firewalld
+[root@gitlab ~]# setenforce 0
+setenforce: SELinux is disabled
+```
+
+开启邮件服务:
+
+```bash
+[root@gitlab ~]# systemctl start postfix
+[root@gitlab ~]# systemctl enable postfix
+```
+
+添加本地解析:
+
+```bash
+[root@gitlab ~]# echo "192.168.159.136 gitlab" >> /etc/hosts
+```
+
+### 3. 安装`gitlab`依赖包
+
+```bash
+[root@gitlab ~]# yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python
+```
+
+### 4. 添加`gitlab`安装源
+
+```bash
+# 阿里源
+[root@gitlab ~]# vim /etc/yum.repos.d/gitlab-ce.repo
+[gitlab-ce]
+name=gitlab-ce
+baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
+Repo_gpgcheck=0
+Enabled=1
+gpgcheck=0
+
+# 清华源
+[root@gitlab ~]# vim /etc/yum.repos.d/gitlab-ce.repo
+[gitlab-ce]
+name=Gitlab CE Repository
+baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
+gpgcheck=0
+enabled=1
+
+[root@gitlab ~]# vim /etc/yum.repos.d/gitlab-ee.repo
+[gitlab-ee]
+name=Gitlab EE Repository
+baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/yum/el$releasever/
+gpgcheck=0
+enabled=1
+
+# 官方源
+[root@gitlab ~]# vim /etc/yum.repos.d/runner_gitlab-ci-multi-runner.repo
+[runner_gitlab-ci-multi-runner]
+name=runner_gitlab-ci-multi-runner
+baseurl=https://packages.gitlab.com/runner/gitlab-ci-multi-runner/el/7/$basearch
+repo_gpgcheck=1
+gpgcheck=0
+enabled=1
+gpgkey=https://packages.gitlab.com/runner/gitlab-ci-multi-runner/gpgkey
+sslverify=1
+sslcacert=/etc/pki/tls/certs/ca-bundle.crt
+metadata_expire=300
+
+[runner_gitlab-ci-multi-runner-source]
+name=runner_gitlab-ci-multi-runner-source
+baseurl=https://packages.gitlab.com/runner/gitlab-ci-multi-runner/el/7/SRPMS
+repo_gpgcheck=1
+gpgcheck=0
+enabled=1
+gpgkey=https://packages.gitlab.com/runner/gitlab-ci-multi-runner/gpgkey
+sslverify=1
+sslcacert=/etc/pki/tls/certs/ca-bundle.crt
+metadata_expire=300
+```
+
+### 5. 安装`gitlab`
+
+```bash
+[root@gitlab ~]# yum -y install gitlab-ce
+```
+
+### 6. 查看`gitlab`版本
+
+```bash
+[root@gitlab ~]# head -1 /opt/gitlab/version-manifest.txt
+gitlab-ce 17.1.1
+```
+
+### 7. `gitlab`配置登录链接
+
+```bash
+# 设置登录链接
+[root@gitlab ~]# vim /etc/gitlab/gitlab.rb
+## GitLab URL
+##! URL on which GitLab will be reachable.
+##! For more details on configuring external_url see:
+##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
+##!
+##! Note: During installation/upgrades, the value of the environment variable
+##! EXTERNAL_URL will be used to populate/replace this value.
+##! On AWS EC2 instances, we also attempt to fetch the public hostname/IP
+##! address from AWS. For more details, see:
+##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+external_url 'http://192.168.159.136'
+
+[root@gitlab ~]# grep "^external_url" /etc/gitlab/gitlab.rb
+external_url 'http://192.168.159.136'
+```
+
+### 8. 初始化`gitlab`
+
+```bash
+[root@gitlab ~]# gitlab-ctl reconfigure
+```
+
+### 9. 启动`gitlab`服务
+
+```bash
+[root@gitlab ~]# gitlab-ctl start
+```
+
+## 二:Gitlab 使用
+
+### 1. `gitlab`服务管理
+
+```bash
+# 启动所有 gitlab 组件
+[root@cicd-gitlab ~]# gitlab-ctl start
+
+# 停止所有 gitlab 组件
+[root@cicd-gitlab ~]# gitlab-ctl stop
+
+# 重启所有 gitlab 组件
+[root@cicd-gitlab ~]# gitlab-ctl restart
+
+# 查看服务状态
+[root@cicd-gitlab ~]# gitlab-ctl status
+
+# 初始化服务
+[root@cicd-gitlab ~]# gitlab-ctl reconfigure
+
+# 修改默认的配置文件
+[root@cicd-gitlab ~]# vim /etc/gitlab/gitlab.rb
+
+# 查看日志
+[root@cicd-gitlab ~]# gitlab-ctl tail
+```
+
+### 2. 登录`Gitlab`
+
+在浏览器中输入 http://192.16.159.136,然后 change password: ,并使用root用户登录 即可 (后续动作根据提示操作)
+
+```bash
+# 查看密码
+# grep 'Password:' /etc/gitlab/initial_root_password
+```
+
+设置中文:
+
+
+
+### 3. Gitlab 部署 https 方式
+
+创建私有密钥:
+
+```bash
+[root@gitlab ~]# mkdir -p /etc/gitlab/ssl
+[root@gitlab ~]# openssl genrsa -out "/etc/gitlab/ssl/gitlab.key" 2048
+Generating RSA private key, 2048 bit long modulus
+..........+++
+....................................................+++
+e is 65537 (0x10001)
+```
+
+创建私有证书:
+
+```bash
+[root@gitlab ~]# openssl req -new -key "/etc/gitlab/ssl/gitlab.key" -out "/etc/gitlab/ssl/gitlab.csr"
+You are about to be asked to enter information that will be incorporated
+into your certificate request.
+What you are about to enter is what is called a Distinguished Name or a DN.
+There are quite a few fields but you can leave some blank
+For some fields there will be a default value,
+If you enter '.', the field will be left blank.
+-----
+Country Name (2 letter code) [XX]:cn
+State or Province Name (full name) []:sh
+Locality Name (eg, city) [Default City]:sh
+Organization Name (eg, company) [Default Company Ltd]: # 输入空格,然后回车
+Organizational Unit Name (eg, section) []: # 输入空格,然后回车
+Common Name (eg, your name or your server's hostname) []:gitlab
+Email Address []:1497427046@qq.com
+
+Please enter the following 'extra' attributes
+to be sent with your certificate request
+A challenge password []:123456
+An optional company name []: # 直接回车
+[root@gitlab ~]# ll /etc/gitlab/ssl/
+总用量 8
+-rw-r--r-- 1 root root 1058 4月 23 10:21 gitlab.csr
+-rw-r--r-- 1 root root 1679 4月 23 10:19 gitlab.key
+```
+
+创建CRT签署证书:
+
+```bash
+[root@gitlab ~]# openssl x509 -req -days 365 -in "/etc/gitlab/ssl/gitlab.csr" -signkey "/etc/gitlab/ssl/gitlab.key" -out "/etc/gitlab/ssl/gitlab.crt"
+Signature ok
+subject=/C=cn/ST=sh/L=sh/O=Default Company Ltd/CN=gitlab/emailAddress=1497427046@qq.com
+Getting Private key
+[root@gitlab ~]# ll /etc/gitlab/ssl/
+总用量 12
+-rw-r--r-- 1 root root 1249 4月 23 10:23 gitlab.crt
+-rw-r--r-- 1 root root 1058 4月 23 10:21 gitlab.csr
+-rw-r--r-- 1 root root 1679 4月 23 10:19 gitlab.key
+```
+
+创建pem证书: 利用openssl命令输出pem证书
+
+```bash
+[root@gitlab ~]# openssl dhparam -out /etc/gitlab/ssl/dhparam.pem 2048
+Generating DH parameters, 2048 bit long safe prime, generator 2
+This is going to take a long time
+...............................+........................................................................................+..++*++*
+```
+
+查看生成的证书:
+
+```bash
+[root@gitlab ~]# ll /etc/gitlab/ssl/
+总用量 16
+-rw-r--r-- 1 root root 424 4月 23 10:23 dhparam.pem
+-rw-r--r-- 1 root root 1249 4月 23 10:23 gitlab.crt
+-rw-r--r-- 1 root root 1058 4月 23 10:21 gitlab.csr
+-rw-r--r-- 1 root root 1679 4月 23 10:19 gitlab.key
+```
+
+更改文件权限:
+
+```bash
+[root@gitlab ~]# chmod 600 /etc/gitlab/ssl/*
+[root@gitlab ~]# ll /etc/gitlab/ssl/
+总用量 16
+-rw------- 1 root root 424 4月 23 10:23 dhparam.pem
+-rw------- 1 root root 1249 4月 23 10:23 gitlab.crt
+-rw------- 1 root root 1058 4月 23 10:21 gitlab.csr
+-rw------- 1 root root 1679 4月 23 10:19 gitlab.key
+```
+
+配置 gitlab:
+
+```bash
+[root@gitlab ~]# cp /etc/gitlab/gitlab.rb{,.bak}
+[root@gitlab ~]# vim /etc/gitlab/gitlab.rb
+external_url 'https://192.168.159.136'
+nginx['redirect_http_to_https'] = true
+nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.crt"
+nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.key"
+ginx['ssl_dhparam'] = "/etc/gitlab/ssl/dhparam.pem" # Path to dhparams.pem, eg. /etc/gitlab/ssl/dhparams.pem
+```
+
+初始化gitlab相关服务配置:
+
+```bash
+[root@gitlab ~]# gitlab-ctl reconfigure
+```
+
+重启 gitlab:
+
+```bash
+[root@gitlab ~]# gitlab-ctl restart
+```
+
+### 4. 浏览器登录 gitlab
+
+
+
+### 5. Gitlab 添加 SMTP 邮件功能
+
+配置邮件功能:
+
+```bash
+[root@gitlab ~]# grep -P "^[^#].*smtp_|user_email|gitlab_email" /etc/gitlab/gitlab.rb
+gitlab_rails['smtp_enable'] = true
+gitlab_rails['smtp_address'] = "smtp.qq.com"
+gitlab_rails['smtp_port'] = 465
+gitlab_rails['smtp_user_name'] = "15253413025@qq.com"
+gitlab_rails['smtp_password'] = "abcdefghijklmnop" # 替换为你的授权码
+gitlab_rails['smtp_domain'] = "qq.com"
+gitlab_rails['smtp_authentication'] = "login"
+gitlab_rails['smtp_enable_starttls_auto'] = false
+gitlab_rails['smtp_tls'] = true
+gitlab_rails['gitlab_email_from'] = "15253413025@qq.com"
+```
+
+停止gitlab服务:
+
+```bash
+[root@gitlab ~]# gitlab-ctl stop
+```
+
+修改配置后需要初始化配置:
+
+```bash
+[root@gitlab ~]# gitlab-ctl reconfigure
+```
+
+启动服务:
+
+```bash
+[root@gitlab ~]# gitlab-ctl start
+```
+
+Gitlab 发送邮件测试:
+
+```bash
+[root@gitlab ~]# gitlab-rails console
+--------------------------------------------------------------------------------
+ Ruby: ruby 3.1.5p253 (2024-04-023 revision 1945f8dc0e) [x86_64-linux]
+ GitLab: 17.1.1 (a1c9a43d543) FOSS
+ GitLab Shell: 14.36.0
+ PostgreSQL: 14.11
+------------------------------------------------------------[ booted in 25.61s ]
+Loading production environment (Rails 7.0.8.4)
+irb(main):001:0> Notify.test_email('15253413025@163.com', 'Message Subject', 'Message Body').deliver_now
+Delivered mail 6808744ba0535_2a952f0896851@gitlab.mail (1308.6ms)
+```
+
+邮箱客户端查看邮件:
+
+
\ No newline at end of file
diff --git a/版本控制.md b/版本控制.md
new file mode 100644
index 0000000..9ce0906
--- /dev/null
+++ b/版本控制.md
@@ -0,0 +1,434 @@
+版本控制
+
+------
+
+## 一:Git 简介
+
+### 1. 介绍
+
+- `Git`是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目
+- `Git`是`Linus Torvalds`为了帮助管理`Linux`内核开发而开发的一个开放源码的版本控制软件
+- `Git`与常用的版本控制工具`CVS`、`Subversion`等不同,它采用了分布式版本库的方式,不必服务器端软件支持
+
+### 2. Git 工作流程
+
+1. 克隆 Git 资源作为工作目录
+2. 在克隆的资源上添加或修改文件
+3. 如果其他人修改了,你可以更新资源
+4. 在提交前查看修改
+5. 提交修改
+6. 在修改完成后,如果发现错误,可以撤回提交并再次修改并提交
+
+
+
+### 3. git 的工作区、暂存区和版本库
+
+**工作区:**就是你在电脑里能看到的目录
+
+**暂存区:**英文叫`stage`,或`index`。一般存放在`git`目录下的`index`文件(`.git/index`)中,所以我们把暂存区有时也叫作索引(index)
+
+**版本库:**工作区有一个隐藏目录`.git`,这个不算工作区,而是`Git`的版本库
+
+
+
+### 4. Git 安装
+
+```bash
+[root@git ~]# yum -y install git curl-devel expat-devel gettext-devel openssl-devel zlib-devel git-core
+```
+
+## 二:Git 使用
+
+`Git`提供了一个叫做`git config`的工具,专门用来配置或读取相应的工作环境变量
+
+这些环境变量,决定了`Git`在各个环节的具体工作方式和行为。这些变量可以存放在以下三个不同的地方:
+
+- `/etc/gitconfig`文件:系统中对所有用户都普遍适用的配置。若使用`git config`时用`--system`选项,读写的就是这个文件
+- `~/.gitconfig`文件:用户目录下的配置文件只适用于该用户。若使用`git config`时用`--global`选项,读写的就是这个文件
+- 当前项目的`Git`目录中的配置文件(也就是工作目录中的`.git/config`文件):这里的配置仅仅针对当前项目有效
+
+### 1. Git 用户信息
+
+配置个人的用户名称和电子邮件地址:
+
+```bash
+[root@git ~]# git config --global user.name "wxin"
+[root@git ~]# git config --global user.email "wxin@163.com"
+```
+
+### 2. 查看配置信息
+
+```bash
+[root@git ~]# git config --list
+user.name=wxin
+user.email=wxin@163.com
+
+用户名和邮箱和github上一致
+```
+
+这些配置我们也可以在`~/.gitconfig`看到,如下所示:
+
+```bash
+[root@git ~]# cat ~/.gitconfig
+[user]
+ name = wxin
+ email = wxin@163.com
+```
+
+注意:
+
+```bash
+git config --global 参数
+取消代理:
+ git config --global --unset http.proxy
+ git config --global --unset https.proxy
+设置代理:
+ git config --global http.proxy http://domain.local\vsilva:Passw0rd@proxyServer:8080
+出现各种 SSL certificate problem 的解决办法:
+ git config --global http.sslVerify false
+```
+
+### 3. 常用的 git 命令
+
+```bash
+# 初始化
+git init
+
+# 将某一个文件添加到暂存区
+git add main.cpp
+
+# 将文件夹下的所有的文件添加到暂存区
+git add .
+
+# 将暂存区中的文件保存成为某一个版本
+git commit -m 'note'
+
+# 查看所有的版本日志
+git log
+
+# 查看现在暂存区的状况
+git status
+
+# 查看现在文件与上一个提交-commit版本的区别
+git diff
+
+# 回到上一个版本
+git reset --hard HEAD^
+
+# XXX为版本编号,回到某一个版本
+git reset --hard XXXXX
+
+# 从主分支pull到本地
+git pull origin master
+
+# 从本地push到主分支
+git push -u origin master
+
+# push默认主分支 ...
+git push
+```
+
+### 4. Git 使用
+
+`ssh`链接:
+
+ 客户机上产生公钥上传到`gitlab`的`SSH-Keys`里,`git clone`下载和`git push`上传都没问题,这种方式很安全
+
+`ssh`连接`github`:
+
+ 登录`github`,这是`github`的主页(如果没有账户需要注册)
+
+`Git`服务器生成秘钥:
+
+```bash
+[root@git ~]# ssh-keygen
+Generating public/private rsa key pair.
+Enter file in which to save the key (/root/.ssh/id_rsa):
+Created directory '/root/.ssh'.
+Enter passphrase (empty for no passphrase):
+Enter same passphrase again:
+Your identification has been saved in /root/.ssh/id_rsa.
+Your public key has been saved in /root/.ssh/id_rsa.pub.
+The key fingerprint is:
+SHA256:HhgQDguY3A8fAlR+unlWK3liO+o/f8bsQ0+sFHQE5zw root@git
+The key's randomart image is:
++---[RSA 2048]----+
+|=+=.o. .oo |
+|oo.B o .+. |
+| ..*.o . .E |
+| oo o . . |
+| . ..S o |
+| o o..+ o |
+| o B o* + |
+| +o= B . |
+| .ooo+.+.. |
++----[SHA256]-----+
+[root@git ~]# cat .ssh/id_rsa.pub
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTniLfB2SsuRFonPOD94/uCyc8x/wSgkmW0Jq8eRoFvW3+DNHon+iwqufSnkodlkGn2zUun9y6vRGJnU69+/hEFSupZ/eCyUNrnPwwE+BDy2CsRr73pckMmXJERw7SedT5VhDCHFYq6a4fxVZjLhhxbfhi55HisRNc99tJBopkXpOMutr9jvKC+p929Jva4COsqUSya3tHMyv9oXTNwaZCibuIlfUghntry7D3ONH6xV9UyFs8NDXR6fanxkDDBuDvQrxDYncf3Zyi5A7OIC5qJp9MGrftOvyKxFZN/ryzC/asac7StP7SqK7d17XBgwr8jr98JfQ8sVOruSUa6Qkj root@git
+```
+
+`Github`添加`Git`服务器秘钥:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`git`服务器上创建项目并上传到`github`:
+
+```bash
+# 创建本地仓库
+[root@git ~]# mkdir /opt/wxin_cloud
+[root@git ~]# cd /opt/wxin_cloud/
+
+# 初始化本地仓库
+[root@git wxin_cloud]# git init
+初始化空的 Git 版本库于 /opt/wxin_cloud/.git/
+
+# 创建文件
+[root@git wxin_cloud]# echo "hello wxin" > wxin
+
+# 将文件添加到本地暂存区
+[root@git wxin_cloud]# git add .
+
+# 将文件提交到本地版本仓库
+[root@git wxin_cloud]# git commit -m "hello"
+[master(根提交) 8eec16d] hello
+ 1 file changed, 1 insertion(+)
+ create mode 100644 wxin
+
+# 为本地仓库添加指定的远程仓库
+[root@git wxin_cloud]# git remote add origin git@github.com:wxin712/wxin_cloud.git
+
+# 查看节点
+[root@git wxin_cloud]# git branch
+* master
+
+# 将文件上传到Github的远程仓库
+[root@git wxin_cloud]# git push -u origin master
+Counting objects: 3, done.
+Writing objects: 100% (3/3), 209 bytes | 0 bytes/s, done.
+Total 3 (delta 0), reused 0 (delta 0)
+remote:
+remote: Create a pull request for 'master' on GitHub by visiting:
+remote: https://github.com/wxin712/wxin_cloud/pull/new/master
+remote:
+To git@github.com:wxin712/wxin_cloud.git
+ * [new branch] master -> master
+分支 master 设置为跟踪来自 origin 的远程分支 master。
+```
+
+`github`查看:
+
+
+
+
+
+注意:这样上传到`github`的分支不能跟`main`分支合并
+
+### 5. 版本穿梭
+
+版本回退:
+
+```bash
+# 用 git log 命令查看:
+# 每一个提交的版本都唯一对应一个 commit 版本号,
+# 使用 git reset 命令退到上一个版本:
+[root@git wxin_cloud]# git log
+commit b0e63bbe3bf54ac7240c06c8fa31bd3f130702e9
+Author: wxin712 <1497427046@qq.com>
+Date: Tue Apr 22 17:57:37 2025 +0800
+
+ modify
+
+commit 8eec16d9cad6dd8df503ab2d346dc5aeb48d6fcb
+Author: wxin712 <1497427046@qq.com>
+Date: Tue Apr 22 17:43:24 2025 +0800
+
+ hello
+
+[root@git wxin_cloud]# git reset --hard 8eec16d9cad6dd8df503ab2d346dc5aeb48d6fcb
+HEAD 现在位于 8eec16d hello
+[root@git wxin_cloud]# git push -f -u origin master
+Total 0 (delta 0), reused 0 (delta 0)
+remote: To git@github.com:wxin712/wxin_cloud.git
+ + b0e63bb...8eec16d master -> master (forced update)
+分支 master 设置为跟踪来自 origin 的远程分支 master。
+```
+
+查看结果:
+
+
+
+```bash
+# 查看命令历史,以便确定要回到哪个版本
+[root@git wxin_cloud]# git reflog
+8eec16d HEAD@{0}: reset: moving to 8eec16d9cad6dd8df503ab2d346dc5aeb48d6fcb
+b0e63bb HEAD@{1}: reset: moving to b0e63bb
+8eec16d HEAD@{2}: reset: moving to 8eec16d9cad6dd8df503ab2d346dc5aeb48d6fcb
+b0e63bb HEAD@{3}: reset: moving to b0e63bb
+8eec16d HEAD@{4}: reset: moving to 8eec16d9cad6dd8df503ab2d346dc5aeb48d6fcb
+b0e63bb HEAD@{5}: commit: modify
+8eec16d HEAD@{6}: commit (initial): hello
+
+# 回退
+[root@git wxin_cloud]# git reset --hard b0e63bb
+HEAD 现在位于 b0e63bb modify
+[root@git wxin_cloud]# git push -f -u origin master
+Counting objects: 5, done.
+Writing objects: 100% (3/3), 240 bytes | 0 bytes/s, done.
+Total 3 (delta 0), reused 0 (delta 0)
+remote: To git@github.com:wxin712/wxin_cloud.git
+ 8eec16d..b0e63bb master -> master
+分支 master 设置为跟踪来自 origin 的远程分支 master。
+```
+
+查看结果:
+
+
+
+### 6. 分支管理
+
+创建分支:
+
+```bash
+# 创建dev分支,然后切换到dev
+[root@git wxin_cloud]# git checkout -b dev
+切换到一个新分支 'dev'
+
+# 查看当前分支
+[root@git wxin_cloud]# git branch
+* dev
+ master
+
+# 创建分支
+[root@git wxin_cloud]# git branch test
+```
+
+分支切换:
+
+```bash
+[root@git wxin_cloud]# git checkout master
+切换到分支 'master'
+[root@git wxin_cloud]# git branch
+ dev
+* master
+ test
+```
+
+合并分支:
+
+```bash
+# 把dev分支的工作成果合并到master分支上
+[root@git wxin_cloud]# git merge dev
+更新 b0e63bb..4cc8b4f
+Fast-forward
+ readme.txt | 1 +
+ 1 file changed, 1 insertion(+)
+ create mode 100644 readme.txt
+```
+
+删除分支:
+
+```bash
+# 删除dev分支了
+[root@git wxin_cloud]# git branch -d dev
+已删除分支 dev(曾为 4cc8b4f)。
+
+# 查看分支
+[root@git wxin_cloud]# git branch
+* master
+```
+
+### 7. GitHub 分支管理
+
+注意:`github`默认的分支是`main`而不是`master`
+
+创建项目:
+
+
+
+
+
+创建分支:
+
+
+
+
+
+
+
+新分支创建文件:
+
+
+
+
+
+
+
+合并分支:
+
+
+
+
+
+
+
+
+
+`main`分支验证是否合并成功:
+
+
+
+### 8. 使用 Github 上的项目
+
+下载仓库到本地:
+
+```bash
+[root@git ~]# cd /opt/
+[root@git opt]# git clone git@github.com:wxin712/wxin_cloud_test.git
+正克隆到 'wxin_cloud_test'...
+remote: Enumerating objects: 7, done.
+remote: Counting objects: 100% (7/7), done.
+remote: Compressing objects: 100% (4/4), done.
+remote: Total 7 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
+接收对象中: 100% (7/7), done.
+```
+
+进入工作目录,进行文件更新:
+
+```bash
+[root@git opt]# ls
+wxin_cloud wxin_cloud_test
+[root@git opt]# cd wxin_cloud_test/
+[root@git wxin_cloud_test]# ls
+README.md wxin
+[root@git wxin_cloud_test]# echo "github's cloud is update" > gitupdate
+[root@git wxin_cloud_test]# git add .
+[root@git wxin_cloud_test]# git commit -m "test update"
+[main f67d4ae] test update
+ 1 file changed, 1 insertion(+)
+ create mode 100644 gitupdate
+[root@git wxin_cloud_test]# git push -u origin main
+Counting objects: 4, done.
+Delta compression using up to 4 threads.
+Compressing objects: 100% (2/2), done.
+Writing objects: 100% (3/3), 324 bytes | 0 bytes/s, done.
+Total 3 (delta 0), reused 0 (delta 0)
+remote: To git@github.com:wxin712/wxin_cloud_test.git
+ 085d909..f67d4ae main -> main
+分支 main 设置为跟踪来自 origin 的远程分支 main。
+```
+
+`github`验证:
+
+