当前位置: 首页 > news >正文

哪些网站可以做淘宝基础销量企业免费网站建设模板下载

哪些网站可以做淘宝基础销量,企业免费网站建设模板下载,免费移动版wordpress,搭建平台网站Git 快速入门 文章目录 Git 快速入门一、代码托管平台#xff08;远程仓库#xff09;二、安装Git三、Git的命令实践Git 的四个区域Git 管理代码的3个场景Git 工作区的理念Git 工作区的生命周期Git 版本回退Git 文件重命名Git查看版本提交日志Git StashGit分支Git标签 四、创…Git 快速入门 文章目录 Git 快速入门一、代码托管平台远程仓库二、安装Git三、Git的命令实践Git 的四个区域Git 管理代码的3个场景Git 工作区的理念Git 工作区的生命周期Git 版本回退Git 文件重命名Git查看版本提交日志Git StashGit分支Git标签 四、创建码云代码仓库五、配置Linux连接码云的代码仓库六、实践代码仓库推送七、Gitlab 安装搭建yum安装方式rpm 包安装方式Gitlab 汉化配置 一、代码托管平台远程仓库 git 是一个分布式版本控制系统,同一个git仓库可以分布在不同的机器上,但是开发团队必须保证在同一个网络中且必须有一个项目的原始版本通常的办法就是让一台电脑充当服务器的角色每天24小时开机,其他每个人都可以在这台服务器仓库里克隆一份代码到自己的电脑上。 并且也可以把各自的代码提交到代码仓库里也能从代码仓库拉取别人的提交。 这样的代码仓库服务器我们可以自由的搭建也可以选择使用免费的托管平台。 Git代码托管平台,首先推荐的是Github,世界范围内的开发者都在使用Github托管代码,可以找到大量优秀的开源项目缺点就是访问可能会卡一点。 其次选择的就是Gitee国内的代码托管平台以及自建Gitlab服务器。 1.国外的代码托管平台全球最大的程序员交友平台 GitHub官网地址https://github.com 2.国内的代码托管平台 Gitee官网地址https://gitee.com/ 二、安装Git 安装Git的方式 Git有多种安装方式 原生的纯命令实行linux学习的操作有很多的GUI图形管理Git的工具 yum install -y git修改环境变量定制Git的环境 git config 控制 Git的行为来定义环境变量 它提供三个环境参数 当时用如下命令配置Git的环境变量时不同的参数会写入信息到不同的文件中 git config --global xxx.xxx –system 针对任意登录该linux系统的用户都生效Git的配置信息写入到/etc/gitconfig –global 全局只针对当前登录的用户生效Git配置写入到 ~/.config/git/config用的最多的 –local 本地只针对一个文件夹生效/learn/database/.git/config 用户Git信息配置 [rootGit ~]# git config --global user.name guan12319 // 配置用户名 [rootGit ~]# git config --global user.email guan12319qq.com // 配置邮箱 [rootGit ~]# git config --global color.ui true //开启Git的颜色区分 [rootGit ~]# cat ~/.gitconfig [user]name guan12319email guan12319qq.com [color]ui true [rootGit ~]# git config --global --list user.nameguan12319 user.emailguan12319qq.com color.uitrue Git 配置相关命令 yum install git -y // 安装Git git --version // 查看Git版本 git config --system --list // 查看系统所有linux用户的通用配置此命令检查 /etcgitconfig git config --global --list // 查看当前Linux用户的配置检查~/.gitconfig 文件 git config --local --list // 查看git目录中的仓库配置文件.gitconfig文件 git config --global user.name guan12319 // 配置当前linux用户全局用户名这台机器所有git仓库都会用这个配置 git config --global user.email guan12319qq.com // 配置当前linux用户全局邮箱 git config --global color.ui true //配置Git语法高亮提示 git config --list // 列出Git能找到的所有配置从不同文件中读取所有结果 git config user.name // 列出Git某一项配置 git help // 获取git帮助 man git // man手册 git help config // 获取config命令的手册 [rootGit ~]# git config --system user.name guan12319 [rootGit ~]# git config --system user.email guan12319qq.com [rootGit ~]# cat /etc/gitconfig [user]name guan12319email guan12319qq.com [rootGit ~]# git config --system --list user.nameguan12319 user.emailguan12319qq.com [rootGit ~]# 三、Git的命令实践 工作目录就是一个linux文件夹git status 查看暂存区状态git本地仓库就是一个git的版本库说白了就是代码目录下的一个git文件夹这就是管理文件变动信息的目录也就是git核心的本地仓库(这个本地库作用是记录所有对文件的修改删除动作git都会记录下来以便于历史回退追踪信息 Git 的四个区域 Git 管理代码的3个场景 1.本地已经有一个代码需要用Git管理 程序员已经吧开发好的程序发给了运维运维要针对这个目录进行git初始化管理 ls /data/nginx_web/ cd/data/nginx_web/ git init #就是对git初始化,生成.git目录2.本地没有代码要新建一个Git版本仓库 (程序员小王要开始写代码了并且从开始就用git进行版本管理) mkdir /my_code/ cd /my_code/ git init # 只要执行git init就表示git初始化开始该目录已经被git管理了 touch hello.shxxxxx以后代码的变动都会被git管理记录)3.本地没有代码也没有Git版本仓库去GitHub代码托管平台下载一个Git版本代码库 git clone https://github.com/xxxx/xxx_codeGit clone命令会去github平台下載一个已经被git管理的代码仓库了 实际操作 场景1 [rootGit ~]# cd / [rootGit /]# mkdir test_git [rootGit /]# cd ./test_git/ [rootGit test_git]# echo echo hello git hello.sh [rootGit test_git]# cat hello.sh echo hello git [rootGit test_git]# bash hello.sh hello git [rootGit test_git]# pwd /test_git [rootGit test_git]# ls -a . .. hello.sh 用Git管理目录 [rootGit test_git]# git init . hint: Using master as the name for the initial branch. This default branch name hint: is subject to change. To configure the initial branch name to use in all hint: of your new repositories, which will suppress this warning, call: hint: hint: git config --global init.defaultBranch name hint: hint: Names commonly chosen instead of master are main, trunk and hint: development. The just-created branch can be renamed via this command: hint: hint: git branch -m name Initialized empty Git repository in /test_git/.git/ [rootGit test_git]# ls -a . .. .git hello.sh 场景2 # 直接用git生成一个本地仓库名字叫 test_git01 [rootGit tmp]# git init test_git01 hint: Using master as the name for the initial branch. This default branch name hint: is subject to change. To configure the initial branch name to use in all hint: of your new repositories, which will suppress this warning, call: hint: hint: git config --global init.defaultBranch name hint: hint: Names commonly chosen instead of master are main, trunk and hint: development. The just-created branch can be renamed via this command: hint: hint: git branch -m name Initialized empty Git repository in /tmp/test_git01/.git/ [rootGit tmp]# ls test_git01 [rootGit tmp]# cd test_git01/ [rootGit test_git01]# ls -a . .. .git [rootGit test_git01]# 场景3 [rootGit test_git01]# git clone https://github.com/pallets/flask.git Cloning into flask... remote: Enumerating objects: 24112, done. remote: Counting objects: 100% (724/724), done. remote: Compressing objects: 100% (307/307), done. remote: Total 24112 (delta 401), reused 645 (delta 388), pack-reused 23388 Receiving objects: 100% (24112/24112), 9.99 MiB | 3.05 MiB/s, done. Resolving deltas: 100% (16160/16160), done. [rootGit test_git01]# ls flask [rootGit test_git01]# ls -a . .. flask .git [rootGit test_git01]# cd flask/ [rootGit flask]# ls CHANGES.rst docs pyproject.toml src CODE_OF_CONDUCT.md examples README.rst tests CONTRIBUTING.rst LICENSE.rst requirements tox.ini [rootGit flask]# ls -a . docs .gitignore requirements .. .editorconfig LICENSE.rst src CHANGES.rst examples .pre-commit-config.yaml tests CODE_OF_CONDUCT.md .flake8 pyproject.toml tox.ini CONTRIBUTING.rst .git README.rst .devcontainer .github .readthedocs.yaml [rootGit flask]# git status On branch main Your branch is up to date with origin/main.nothing to commit, working tree clean [rootGit flask]# touch hello.txt [rootGit flask]# git status On branch main Your branch is up to date with origin/main.Untracked files:(use git add file... to include in what will be committed)hello.txtnothing added to commit but untracked files present (use git add to track) [rootGit flask]# git add . [rootGit flask]# git status On branch main Your branch is up to date with origin/main.Changes to be committed:(use git restore --staged file... to unstage)new file: hello.txt[rootGit flask]# Git 工作区的理念 1. git命令 生成一个工作区也就是git对该文件夹进行管理 [rootGit ~]# mkdir /git_code [rootGit ~]# cd /git_code [rootGit git_code]# ls -a . ..[rootGit git_code]# git init hello_git hint: Using master as the name for the initial branch. This default branch name hint: is subject to change. To configure the initial branch name to use in all hint: of your new repositories, which will suppress this warning, call: hint: hint: git config --global init.defaultBranch name hint: hint: Names commonly chosen instead of master are main, trunk and hint: development. The just-created branch can be renamed via this command: hint: hint: git branch -m name Initialized empty Git repository in /git_code/hello_git/.git/ 2.查看git工作区的本地仓库 .git这个隐藏文件夹就是git的本地仓库 [rootGit git_code]# ls -a . .. hello_git [rootGit git_code]# cd hello_git/ [rootGit hello_git]# ls -a . .. .git [rootGit hello_git]# cd .git/ [rootGit .git]# ls branches config description HEAD hooks info objects refs3.通过 tree 命令查看.git工作区的信息 .git 本地仓库的内容 [rootGit .git]# tree . ├── branches ├── config // 该Git项目独有的配置文件 ├── description ├── HEAD // git的文件指针 ├── hooks │ ├── applypatch-msg.sample │ ├── commit-msg.sample │ ├── fsmonitor-watchman.sample │ ├── post-update.sample │ ├── pre-applypatch.sample │ ├── pre-commit.sample │ ├── pre-merge-commit.sample │ ├── prepare-commit-msg.sample │ ├── pre-push.sample │ ├── pre-rebase.sample │ ├── pre-receive.sample │ ├── push-to-checkout.sample │ └── update.sample │---index // index 文件保存暂存区的信息只有git add 之后才会生成 ├── info │ └── exclude ├── objects │ ├── info │ └── pack └── refs├── heads└── tags9 directories, 17 files [rootGit .git]# 4.查看工作区的信息查看文件变动状态未跟踪已跟踪 [rootGit hello_git]# ls -a . .. .git [rootGit hello_git]# git status On branch masterNo commits yetnothing to commit (create/copy files and use git add to track) [rootGit hello_git]# [rootGit hello_git]# git status On branch masterNo commits yetnothing to commit (create/copy files and use git add to track) 5.在工作区进行文件创建发生一些变化 [rootGit hello_git]# touch hello.sh # 此时git会提示你是否要 git 添加到暂存区 [rootGit hello_git]# git status On branch masterNo commits yetUntracked files:(use git add file... to include in what will be committed)hello.shnothing added to commit but untracked files present (use git add to track)6.确认要添加跟踪这个文件 [rootGit hello_git]# git add . # git 会询问你是否要提交到本地仓库 [rootGit hello_git]# git status On branch masterNo commits yetChanges to be committed:(use git rm --cached file... to unstage)new file: hello.sh7.确认提交到本地仓库 [rootGit hello_git]# git commit -m guan12319 first commit [master (root-commit) 7cbd4e8] guan12319 first commit1 file changed, 0 insertions(), 0 deletions(-)create mode 100644 hello.sh [rootGit hello_git]# git status On branch master nothing to commit, working tree cleanGit 工作区的生命周期 1.未跟踪进入暂存区 git add .2.进行版本库提交将暂存区的内容写入到本地仓库 git commit -m“提交注释3.此时文件被修改了从unmodified状态变更为 modified已经修改的状态 4.再次提交这个被修改的文件进入暂存区 git add file5.再次的提交版本 git commit -m 修改了文件6.从本地仓库中删除对某个文件的跟踪 #将文件回退到未跟踪的状态 git rm --cached 文件名7.此时对上述的删除动作可有3个选择 直接删除这个文件 rm -rf test.sh撤销你刚才的 git rm 操作 git restore --staged test.sh再次进入跟踪状态然后 git commit -m 提交 git add .[rootGit hello_git]# ls hello_05.sh hello.sh [rootGit hello_git]# git rm --cached hello.sh rm hello.sh [rootGit hello_git]# git status On branch master Changes to be committed:(use git restore --staged file... to unstage)deleted: hello.shUntracked files:(use git add file... to include in what will be committed)hello.sh[rootGit hello_git]# git restore --staged hello.sh [rootGit hello_git]# git status On branch master nothing to commit, working tree clean [rootGit hello_git]# Git 版本回退 版本回退这么多那应该怎么样回到之前的版本 git reset --hard HEAD^ // 回到上一个版本 # 查看git所记的你每一次版本提交与回退记录的日志 git reflog # 回退到指定版本 git reset --hard 7cbd4e8[rootGit hello_git]# git reflog 6431a7b (HEAD - master) HEAD{0}: commit: guan12319 third commit 530916c HEAD{1}: commit: guan12319 second commit 7cbd4e8 HEAD{2}: commit (initial): guan12319 first commit [rootGit hello_git]# git reset --hard HEAD^ HEAD is now at 530916c guan12319 second commit [rootGit hello_git]# git reflog 530916c (HEAD - master) HEAD{0}: reset: moving to HEAD^ 6431a7b HEAD{1}: commit: guan12319 third commit 530916c (HEAD - master) HEAD{2}: commit: guan12319 second commit 7cbd4e8 HEAD{3}: commit (initial): guan12319 first commit [rootGit hello_git]# git reset --hard HEAD^^ fatal: ambiguous argument HEAD^^: unknown revision or path not in the working tree. Use -- to separate paths from revisions, like this: git command [revision...] -- [file...] [rootGit hello_git]# git reset --hard HEAD^ HEAD is now at 7cbd4e8 guan12319 first commit [rootGit hello_git]# git reflog 7cbd4e8 (HEAD - master) HEAD{0}: reset: moving to HEAD^ 530916c HEAD{1}: reset: moving to HEAD^ 6431a7b HEAD{2}: commit: guan12319 third commit 530916c HEAD{3}: commit: guan12319 second commit 7cbd4e8 (HEAD - master) HEAD{4}: commit (initial): guan12319 first commit [rootGit hello_git]# git reset --hard 6431a7b HEAD is now at 6431a7b guan12319 third commit [rootGit hello_git]# git reflog 6431a7b (HEAD - master) HEAD{0}: reset: moving to 6431a7b 7cbd4e8 HEAD{1}: reset: moving to HEAD^ 530916c HEAD{2}: reset: moving to HEAD^ 6431a7b (HEAD - master) HEAD{3}: commit: guan12319 third commit 530916c HEAD{4}: commit: guan12319 second commit 7cbd4e8 HEAD{5}: commit (initial): guan12319 first commit [rootGit hello_git]# ls hello_05.sh hello.sh [rootGit hello_git]# git reset --hard 7cbd4e8 HEAD is now at 7cbd4e8 guan12319 first commit [rootGit hello_git]# ls hello.sh [rootGit hello_git]# git reflog 7cbd4e8 (HEAD - master) HEAD{0}: reset: moving to 7cbd4e8 6431a7b HEAD{1}: reset: moving to 6431a7b 7cbd4e8 (HEAD - master) HEAD{2}: reset: moving to HEAD^ 530916c HEAD{3}: reset: moving to HEAD^ 6431a7b HEAD{4}: commit: guan12319 third commit 530916c HEAD{5}: commit: guan12319 second commit 7cbd4e8 (HEAD - master) HEAD{6}: commit (initial): guan12319 first commit Git 文件重命名 Git查看版本提交日志 程序员写代码写了一部分的功能就进行一次存档git commit 当发现某个错误约话可以随时的回到某个存档的状态 1.查看git仓库的提交版本信息 [rootGit hello_git]# git log commit 530916c49a6ed59cda9668dfed72b54146ccbebe (HEAD - master) Author: guan12319 guan12319qq.com Date: Sat Aug 5 20:51:11 2023 0800guan12319 second commitcommit 7cbd4e8d6edb2e0b8324967c02ac3a62f1e68292 Author: guan12319 guan12319qq.com Date: Sat Aug 5 20:24:31 2023 0800guan12319 first commit 2.一行显示简短的实现git版本信息 [rootGit hello_git]# git log --oneline 530916c (HEAD - master) guan12319 second commit 7cbd4e8 guan12319 first commit 3.显示最新的1个提交记录 [rootGit hello_git]# git log -1 commit 530916c49a6ed59cda9668dfed72b54146ccbebe (HEAD - master) Author: guan12319 guan12319qq.com Date: Sat Aug 5 20:51:11 2023 0800guan12319 second commit Git Stash Git Stash 实验 git stash就是吧暂存区还未提交的内容,临时存放到一个区域,便于日后再取回来使用 git stash save 注释 // 保存暂存区工作进度 git stash list // 查看stash保存的列表以及id git stash pop // 恢复最新的stash进度到工作区 git stash pop stash——id // 恢复指定的stash 进度 git stash clear // 清空所有存储的stash进度 git stash drop stash_id // 删除一个存储的stash进度1.初始化生成一个新的git仓库 git init hello_git # 在该目录进行一次版本提交 cd hello_git touch hello.sh git add . git commit -m guan12319 first commit 2.再次写入新的内容然后提交到暂存区并且放入stash 临时空间 [rootGit hello_git]# ls hello.sh [rootGit hello_git]# cat hello.sh [rootGit hello_git]# echo hello guan12319 stash.git.txt [rootGit hello_git]# ls hello.sh stash.git.txt [rootGit hello_git]# cat stash.git.txt hello guan12319 [rootGit hello_git]# git status On branch master Untracked files:(use git add file... to include in what will be committed)stash.git.txtnothing added to commit but untracked files present (use git add to track) [rootGit hello_git]# git add . [rootGit hello_git]# git status On branch master Changes to be committed:(use git restore --staged file... to unstage)new file: stash.git.txt3.此时程序员小王突然临时要去做其他事情比如开发另一个功能但是这个写好的代码文件又不想把它给删除了这时就可以使用 git stash [rootGit hello_git]# ls hello.sh stash.git.txt [rootGit hello_git]# git stash save save stash.git.txt ing... Saved working directory and index state On master: save stash.git.txt ing... # 执行命令后stash.git.txt 这个文件就存入stash空间了 [rootGit hello_git]# ls hello.sh 4.此时该文件就会放入到stash临时空间这时你就可以去处理其他事情了。当你把其他事情做完又可以把存入stash空间的文件找回来继续写代码了 [rootGit hello_git]# ls hello.sh [rootGit hello_git]# echo 我现在是在执行了stash之后又做了其他事情 hello.txt[rootGit hello_git]# ls hello.sh hello.txt[rootGit hello_git]# git add . [rootGit hello_git]# git commit -m guan12319 forth commit [master 6b60834] guan12319 forth commit1 file changed, 1 insertion()create mode 100644 hello.txt [rootGit hello_git]# git log --oneline 6b60834 (HEAD - master) guan12319 forth commit 7cbd4e8 guan12319 first commit [rootGit hello_git]# git status On branch master nothing to commit, working tree clean [rootGit hello_git]# ls hello.sh hello.txt [rootGit hello_git]# git stash list stash{0}: On master: save stash.git.txt ing... [rootGit hello_git]# git stash pop stash{0} On branch master Changes to be committed:(use git restore --staged file... to unstage)new file: stash.git.txtDropped stash{0} (e6cba9dd28e3af3b0e1007d13d91045998c3b6ee) [rootGit hello_git]# ls hello.sh hello.txt stash.git.txt [rootGit hello_git]# git commit -m guan12319 创建了 stash.git.txt文件并且提交了 [master d3efdfd] guan12319 创建了 stash.git.txt文件并且提交了1 file changed, 1 insertion()create mode 100644 stash.git.txt [rootGit hello_git]# git status On branch master nothing to commit, working tree clean [rootGit hello_git]# git stash list [rootGit hello_git]# git log --oneline d3efdfd (HEAD - master) guan12319 创建了 stash.git.txt文件并且提交了 6b60834 guan12319 forth commit 7cbd4e8 guan12319 first commit Git分支 1.查看当前的分支情况 git branch2.创建一个guan01分支也就表示该员工可以使用该分支进行自己的独立空间的代码管理 git branch guan013.切换到分支下去写代码查看效果 git checkout guan014.git 分支的管理实践 先创建分支 [rootGit hello_git]# git branch guan01 [rootGit hello_git]# git branchguan01 * master 切换到分支下 [rootGit hello_git]# git checkout guan01 Switched to branch guan01 [rootGit hello_git]# git branch * guan01master在分支下创建文件提交到暂存区并且要进行版本提交此时该文件就提交到了该分支下的版本空间内 [rootGit hello_git]# git checkout guan01 Switched to branch guan01 [rootGit hello_git]# echo 我是guan12319 guan001.txt [rootGit hello_git]# ls guan001.txt hello.sh hello.txt stash.git.txt [rootGit hello_git]# git status On branch guan01 Untracked files:(use git add file... to include in what will be committed)guan001.txtnothing added to commit but untracked files present (use git add to track) [rootGit hello_git]# git checkout master Switched to branch master [rootGit hello_git]# ls guan001.txt hello.sh hello.txt stash.git.txt [rootGit hello_git]# git status On branch master Untracked files:(use git add file... to include in what will be committed)guan001.txtnothing added to commit but untracked files present (use git add to track) [rootGit hello_git]# git branch guan01 * master [rootGit hello_git]# git checkout guan01 Switched to branch guan01 [rootGit hello_git]# git status On branch guan01 Untracked files:(use git add file... to include in what will be committed)guan001.txtnothing added to commit but untracked files present (use git add to track) [rootGit hello_git]# git add . [rootGit hello_git]# git status On branch guan01 Changes to be committed:(use git restore --staged file... to unstage)new file: guan001.txt[rootGit hello_git]# git checkout guan01 A guan001.txt Switched to branch guan01 [rootGit hello_git]# git status On branch guan01 Changes to be committed:(use git restore --staged file... to unstage)new file: guan001.txt[rootGit hello_git]# git commit -m guan001 第一次提交 [guan01 c71e0e2] guan001 第一次提交1 file changed, 1 insertion()create mode 100644 guan001.txt [rootGit hello_git]# git status On branch guan01 nothing to commit, working tree clean [rootGit hello_git]# ls guan001.txt hello.sh hello.txt stash.git.txt [rootGit hello_git]# git branch * guan01master [rootGit hello_git]# git log commit c71e0e28d025e02ecbfa0e04fedd54d690c7d55e (HEAD - guan01) Author: guan12319 guan12319qq.com Date: Sat Aug 5 22:51:26 2023 0800guan001 第一次提交commit d3efdfdb85cb14e22e2e1dccef65015fd86a3081 (master) Author: guan12319 guan12319qq.com Date: Sat Aug 5 22:22:43 2023 0800guan12319 创建了 stash.git.txt文件并且提交了commit 6b60834a06caff7d614ecef7e97d3434ea33a68e Author: guan12319 guan12319qq.com Date: Sat Aug 5 22:18:58 2023 0800guan12319 forth commitcommit 7cbd4e8d6edb2e0b8324967c02ac3a62f1e68292 Author: guan12319 guan12319qq.com Date: Sat Aug 5 20:24:31 2023 0800guan12319 first commit 这时候在切回master 查看状态 [rootGit hello_git]# git checkout master A guan001.txt Switched to branch master [rootGit hello_git]# git status On branch master Changes to be committed:(use git restore --staged file... to unstage)new file: guan001.txt[rootGit hello_git]# ls guan001.txt hello.sh hello.txt stash.git.txt [rootGit hello_git]# git checkout master Switched to branch master [rootGit hello_git]# git status On branch master nothing to commit, working tree clean [rootGit hello_git]# ls hello.sh hello.txt stash.git.txt [rootGit hello_git]# git log commit d3efdfdb85cb14e22e2e1dccef65015fd86a3081 (HEAD - master) Author: guan12319 guan12319qq.com Date: Sat Aug 5 22:22:43 2023 0800guan12319 创建了 stash.git.txt文件并且提交了commit 6b60834a06caff7d614ecef7e97d3434ea33a68e Author: guan12319 guan12319qq.com Date: Sat Aug 5 22:18:58 2023 0800guan12319 forth commitcommit 7cbd4e8d6edb2e0b8324967c02ac3a62f1e68292 Author: guan12319 guan12319qq.com Date: Sat Aug 5 20:24:31 2023 0800guan12319 first commit [rootGit hello_git]# ls hello.sh hello.txt stash.git.txt 这时可以看到在master里没有guan001的提交记录5.此时可以选择删除这个分支的记录也可以选择合并这个分支的提交记录合并到master分支上 删除该分支该分支的提交的版本信息也会随之删除 [rootGit hello_git]# git branch -D guan01选择合并分支的情况如下 # 创建一个新的分支并立即切换到该分支 [rootGit hello_git]# git checkout -b guan003 Switched to a new branch guan003 [rootGit hello_git]# git branch * guan003master#合并guan01分支 [rootGit hello_git]# git checkout master Switched to branch master [rootGit hello_git]# git branch guan003guan01 * master [rootGit hello_git]# lshello.sh hello.txt stash.git.txt [rootGit hello_git]# git merge guan01 Updating d3efdfd..c71e0e2 Fast-forwardguan001.txt | 1 1 file changed, 1 insertion()create mode 100644 guan001.txt [rootGit hello_git]# git status On branch master nothing to commit, working tree clean [rootGit hello_git]# ls guan001.txt hello.sh hello.txt stash.git.txt [rootGit hello_git]# git log --oneline c71e0e2 (HEAD - master, guan01) guan001 第一次提交 d3efdfd (guan003) guan12319 创建了 stash.git.txt文件并且提交了 6b60834 guan12319 forth commit 7cbd4e8 guan12319 first commit [rootGit hello_git]# git branchguan003guan01 * master [rootGit hello_git]# 当分支的提交被合并后该分支就可以删除了随时用分支在创建就行 [rootGit hello_git]# git branch -d guan01 Deleted branch guan01 (was c71e0e2). [rootGit hello_git]# git branch -d guan003 Deleted branch guan003 (was d3efdfd). Git 分支合并冲突如何解决 Git标签 Git tag 是一个便于记忆的标签可以是字符也可以是数字 tag主要是和commit记录绑定在一起的 1.对于当前最新的版本记录加上一个标签 # -a 标签名字-m 给标签再加上一个注释 [rootGit hello_git]# git tag -a v1.0 -m 完成了最后一个test.txt代码编写项目.成 2.可以直接输入 git tag 查看当前的标签版本 也可以查看 commit id 和 tag 的关系 [rootGit hello_git]# git tag v1.0 [rootGit hello_git]# git log --oneline --decorate c71e0e2 (HEAD - master, tag: v1.0) guan001 第一次提交 d3efdfd guan12319 创建了 stash.git.txt文件并且提交了 6b60834 guan12319 forth commit 7cbd4e8 guan12319 first commit [rootGit hello_git]# git log --oneline --decorate --graph * c71e0e2 (HEAD - master, tag: v1.0) guan001 第一次提交 * d3efdfd guan12319 创建了 stash.git.txt文件并且提交了 * 6b60834 guan12319 forth commit * 7cbd4e8 guan12319 first commit 给指定 commit id 打标签 [rootGit hello_git]# git tag -a v0.1 7cbd4e8 -m 这是7cbd4e8的tag [rootGit hello_git]# git log --oneline --decorate --graph * c71e0e2 (HEAD - master, tag: v1.0) guan001 第一次提交 * d3efdfd guan12319 创建了 stash.git.txt文件并且提交了 * 6b60834 guan12319 forth commit * 7cbd4e8 (tag: v0.1) guan12319 first commit 查看某个标签的详细信息 [rootGit hello_git]# git show v1.0 tag v1.0 Tagger: guan12319 guan12319qq.com Date: Sat Aug 5 23:25:11 2023 0800完成了最后一个test.txt代码编写项目完成commit c71e0e28d025e02ecbfa0e04fedd54d690c7d55e (HEAD - master, tag: v1.0) Author: guan12319 guan12319qq.com Date: Sat Aug 5 22:51:26 2023 0800guan001 第一次提交diff --git a/guan001.txt b/guan001.txt new file mode 100644 index 0000000..74fc915 --- /dev/nullb/guan001.txt-0,0 1 我是guan12319 删除标签 [rootGit hello_git]# git tag v0.1 v1.0 [rootGit hello_git]# git tag -d v0.1 Deleted tag v0.1 (was 6f5abec) [rootGit hello_git]# git tag v1.0 四、创建码云代码仓库 对于码云或者github来说已经创建号代码仓库的后续的用法分为2个场景 在linux机器上已经存在一个Git本地仓库/opt/my_crm/.git在Linux机器上没有Git代码仓库 Git init初始化Git clone 下载Git仓库 五、配置Linux连接码云的代码仓库 简易的命令行入门教程: Git 全局设置: git config --global user.name guan12319 git config --global user.email guan12319qq.com创建 git 仓库: mkdir test_git cd test_git git init touch README.md git add README.md git commit -m first commit # git和码云的运程绑定操作 # git 命令给运程代码仓库地址加上一个别名叫做origin git remote add origin https://gitee.com/sound-of-birds-chirpingg/test_git.git # 推送代码命令 git push -u origin master已有仓库? cd existing_git_repo # 如果该代码仓库还未知和远程仓库绑定执行如下命令 git remote add origin https://gitee.com/sound-of-birds-chirpingg/test_git.git git push -u origin master六、实践代码仓库推送 注意linux和码云的仓库绑定的时候一定要注意是什么协议 选择ssh协议就得配置ssh-key免密推送选择https协议就输入账户密码 mkdir test_git cd test_git git init touch README.md git add README.md git commit -m first commit # git和码云的运程绑定操作 # git 命令给运程代码仓库地址加上一个别名叫做origin git remote add origin https://gitee.com/sound-of-birds-chirpingg/test_git.git # 推送代码命令 git push -u origin master[rootGit my_crm]# git remote add origin gitgitee.com:sound-of-birds-chirpingg/test_git.git [rootGit my_crm]# git push -u origin master The authenticity of host gitee.com (182.255.33.134) cant be established. ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQpKkGYoFgbVr17bmjey0Wc. Are you sure you want to continue connecting (yes/no/[fingerprint])? y Please type yes, no or the fingerprint: yes Warning: Permanently added gitee.com,182.255.33.134 (ECDSA) to the list of known hosts. gitgitee.com: Permission denied (publickey). fatal: Could not read from remote repository.Please make sure you have the correct access rights and the repository exists. [rootGit my_crm]# git remote add origin https://gitee.com/sound-of-birds-chirpingg/test_git.git error: remote origin already exists. # 删除 remote origin [rootGit my_crm]# git remote remove origin # 使用 HTTP 协议进行推送需要使用码云的账号和密码登录 [rootGit my_crm]# git remote add origin https://gitee.com/sound-of-birds-chirpingg/test_git.git 推送 [rootGit my_crm]# git push -u origin master Username for https://gitee.com: guan12319qq.com Password for https://guan12319qq.comgitee.com: Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Writing objects: 100% (3/3), 233 bytes | 233.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 remote: Powered by GITEE.COM [GNK-6.4] To https://gitee.com/sound-of-birds-chirpingg/test_git.git* [new branch] master - master branch master set up to track origin/master. 使用 ssh-key 免密推送 1.在Linux客户端生成密钥对 [rootGit my_crm]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): 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:ZwhRsJtahCDL4cicyMvtKqeHcKeJZDqwLGpSnL7mpk rootGit The keys randomart image is: ---[RSA 3072]---- |... oo. | |Ooo. . o | |B . | |. o . . | | o S o | |oo* .o o | |BB . | |XoO.. | |OXE | ----[SHA256]----- 2.复制公钥上传到码云 [rootGit my_crm]# cat ~/.ssh/id_rsa.pub // 公钥位置3.可以使用 ssh 协议直接推送 [rootGit my_crm]# ls git.txt [rootGit my_crm]# echo hello git hello.txt [rootGit my_crm]# git status On branch master Your branch is up to date with origin/master.Untracked files:(use git add file... to include in what will be committed)hello.txtnothing added to commit but untracked files present (use git add to track) [rootGit my_crm]# git add . [rootGit my_crm]# git commit -m 第二次推送 [master 35be056] 第二次推送1 file changed, 1 insertion()create mode 100644 hello.txt [rootGit my_crm]# git push -u origin master Username for https://gitee.com: ^C [rootGit my_crm]# git remote remove origin [rootGit my_crm]# git remote add origin gitgitee.com:sound-of-birds-chirpingg/test_git.git [rootGit my_crm]# git push -u origin master Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 2 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 290 bytes | 290.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 remote: Powered by GITEE.COM [GNK-6.4] To gitee.com:sound-of-birds-chirpingg/test_git.gitb9bcb2d..35be056 master - master branch master set up to track origin/master. 远程获取仓库代码 1.执行代码克隆命令 # 如果是https协议就需要账户密码验证 git clone 因为提前做了免密所以就使用ssh协议下载 [rootjenkins ~]# mkdir ./git_code [rootjenkins ~]# cd ./git_code [rootjenkins git_code]# ls [rootjenkins git_code]# git clone gitgitee.com:sound-of-birds-chirpingg/test_git.git Cloning into test_git... The authenticity of host gitee.com (182.255.33.134) cant be established. ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQpKkGYoFgbVr17bmjey0Wc. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added gitee.com,182.255.33.134 (ECDSA) to the list of known hosts. remote: Enumerating objects: 6, done. remote: Counting objects: 100% (6/6), done. remote: Compressing objects: 100% (3/3), done. remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (6/6), done. [rootjenkins git_code]# ls test_git [rootjenkins git_code]# cd test_git/ [rootjenkins test_git]# ls git.txt hello.txt [rootjenkins test_git]# ls -a . .. .git git.txt hello.txt 从仓库拉取更新后的代码 分别在两台linux服务器上都clone下载号码云的代码 1.在服务器A上往代码仓库推送内容这时仓库更新了一些内容 [rootGit my_crm]# ls git.txt hello.txt [rootGit my_crm]# echo hello guan guan.txt [rootGit my_crm]# git add . [rootGit my_crm]# git commit -m learn git of pull [master e01d263] learn git of pull1 file changed, 1 insertion()create mode 100644 guan.txt [rootGit my_crm]# git push -u origin master Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 2 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 305 bytes | 305.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 remote: Powered by GITEE.COM [GNK-6.4] To gitee.com:sound-of-birds-chirpingg/test_git.git35be056..e01d263 master - master branch master set up to track origin/master. 2.此时机器B的内容还是更新之前的内容 3.在服务器B上拉取代码仓库更新后的内容 git pull origin master[rootjenkins test_git]# ls -a . .. .git git.txt hello.txt [rootjenkins test_git]# git pull origin master remote: Enumerating objects: 4, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), 285 bytes | 285.00 KiB/s, done. From gitee.com:sound-of-birds-chirpingg/test_git* branch master - FETCH_HEAD35be056..e01d263 master - origin/master Updating 35be056..e01d263 Fast-forwardguan.txt | 1 1 file changed, 1 insertion()create mode 100644 guan.txt [rootjenkins test_git]# ls git.txt guan.txt hello.txt 4.此时服务器A和服务器B的本地代码就和远程仓库的内容就保持一致了 七、Gitlab 安装搭建 Gitlab官网地址https://gitlab.cn/ yum安装方式 1.安装和配置必须的依赖项 [rootGit ~]# yum install -y curl policycoreutils-python openssh-server perl Last metadata expiration check: 1:10:38 ago on Sun 06 Aug 2023 01:16:17 AM CST. Package curl-7.61.1-31.el8.x86_64 is already installed. No match for argument: policycoreutils-python Package openssh-server-8.0p1-17.el8.x86_64 is already installed. Package perl-4:5.26.3-422.el8.x86_64 is already installed. Error: Unable to find a match: policycoreutils-python [rootGit ~]# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm [rootGit ~]# yum install -y curl policycoreutils-python3 openssh-server[rootGit ~]# systemctl enable sshd [rootGit ~]# systemctl start sshd [rootGit ~]# firewall-cmd --permanent --add-servicehttp success [rootGit ~]# firewall-cmd --permanent --add-servicehttps success [rootGit ~]# systemctl reload firewalld [rootGit ~]# yum install postfix Last metadata expiration check: 1:17:20 ago on Sun 06 Aug 2023 01:16:17 AM CST. Package postfix-2:3.5.8-6.el8.x86_64 is already installed. Dependencies resolved. Nothing to do. Complete! [rootGit ~]# systemctl enable postfix [rootGit ~]# systemctl start postfix rpm 包安装方式 清华源gitlab的rpm包下载地址https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/ [rootcode ~]# mkdir /gitlab [rootcode ~]# cd /gitlab [rootcode gitlab]# [rootcode gitlab]# rpm -ivh gitlab-ce-16.0.0-ce.0.el7.x86_64.rpm 警告gitlab-ce-16.0.0-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY 准备中... ################################# [100%] 正在升级/安装...1:gitlab-ce-16.0.0-ce.0.el7 ################################# [100%] It looks like GitLab has not been configured yet; skipping the upgrade script.*. *.*** ******** *****.****** *************** ********,,,,,,,,,***********,,,,,,,,,,,,,,,,,,,,*********,,,,,,,,,,,.,,,,,,,,,,,*******,,,,,,,,,,,,,,,,,,,,,*****,,,,,,,,,.,,,,,,,****,,,,,,.,,,***,,,,,*,._______ __ __ __/ ____(_) /_/ / ____ _/ /_/ / __/ / __/ / / __ / __ \/ /_/ / / /_/ /___/ /_/ / /_/ /\____/_/\__/_____/\__,_/_.___/Thank you for installing GitLab! GitLab was unable to detect a valid hostname for your instance. Please configure a URL for your GitLab instance by setting external_url configuration in /etc/gitlab/gitlab.rb file. Then, you can start your GitLab instance by running the following command:sudo gitlab-ctl reconfigureFor a comprehensive list of configuration options please see the Omnibus GitLab readme https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.mdHelp us improve the installation experience, let us know how we did with a 1 minute survey: https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installationomnibusrelease16-0[rootcode gitlab]# ls gitlab-ce-16.0.0-ce.0.el7.x86_64.rpm 2.修改gitlab的一些基础配置然后运行gitlab页面 [rootcode gitlab]# vim /etc/gitlab/gitlab.rb #external_url http://gitlab.example.com external_url http://192.168.200.181 ... ### Email Settings gitlab_rails[gitlab_email_from] guan12319qq.com gitlab_rails[gitlab_email_display_name] guan_gitlab #gitlab_rails[gitlab_email_reply_to] noreplyexample.com #gitlab_rails[gitlab_email_subject_suffix] gitlab_rails[gitlab_email_smime_enabled] true... ### GitLab email server settings gitlab_rails[smtp_enable] true gitlab_rails[smtp_address] smtp.qq.com gitlab_rails[smtp_port] 465 gitlab_rails[smtp_user_name] 2054210430qq.com gitlab_rails[smtp_password] smtp password // 去邮箱的设置里获取授权码 gitlab_rails[smtp_domain] smtp.qq.com gitlab_rails[smtp_authentication] login gitlab_rails[smtp_enable_starttls_auto] true gitlab_rails[smtp_tls] true gitlab_rails[smtp_pool] false [rootcode gitlab]# grep -Ev ^# /etc/gitlab/gitlab.rb | grep -Ev ^$3.测试gitlab命令行是否正确 执行gitlab的配置重新读取 gitlab-ctl reconfigure测试发邮件 gitlab-rails console Notify.test_email(guan12319qq.com,hello,hello guan).deliver_now4.修改了gitlab的配置文件就需要重新加载gitlab配置文件 gitlab-ctl reconfigure启动、停止、查看状态 gitlab-ctl start | restart | status | stop初始化之后gitlab组件都已经启动了 gitlab-ctl status5.gitlab 运行的组件如下 GitLab 由主要由以下服务构成他们共同承担了 Gitlab 的运作需要Nginx:静态 web 服务器。 gitlab-shell用于处理 Git 命令和修改 authorized keys 列表。 gitlab-workhorse轻量级的反向代理服务器。 logrotate:日志文件管理工具。 postgresql数据库。 redis缓存数据库。 sidekic用于在后台执行队列任务异步执行)。unigorn:An HTTP server for Rack applications, GitLab Rails 应用是托管在这个6.访问gitlab 在浏览器中输入linux服务器的IP地址就行 7.gitlab相关访问命令和目录 gitlab-ctl start gitlab-ctl stop gitlab-ctl restart gitlab-ctl status gitlab-ctl stop postgresql gitlab-ctl reconfigure gitlab-ctl tail gitlab-ctl tail redis/var/opt/gitlab/git-data/repositories/ :库默认存储目录 /opt/gitlab 应用代码和相应的依赖程序 /var/opt/gitlab/ : gitlab-ctl reconfigure生成的数据和配置 /etc/gitlab :配置文件目录 /var/log/gitlab此目录下存放了gitlab各个组件产生的日志 /var/opt/gitlab/backups 备份文件生成的目录Gitlab 汉化配置 1.获取汉化包 Gitlab汉化包下载地址https://gitlab.com/xhang/gitlab 2.检查汉化包与gitlab的版本是否一致 3.关闭 gitlab 服务 gitlab-ctl stop4.解压缩汉化包拷贝其中内容 unzip 汉化包.zip cp -rf 解压出来的汉化包目录/* /opt/gitlab/embedded/service/gitlab-rails/5.重新启动 gitlab-ctl restart检查gitlab的运行日志检测所有组件的日志看运行结果 6.重新在浏览器访问就可以看到汉化的页面了
http://www.yutouwan.com/news/218116/

相关文章:

  • jsp做的零食小网站建设工程信息在哪个网站
  • 需要大量做网站做推广的行业建筑图纸字母代号大全图解
  • 宜昌网站推广优化技巧全自动推广引流软件
  • 西安当地做网站的公司深圳物流托运上门取件
  • 北京市住房与建设厅官方网站做网站需要几万吗
  • 云主机网站源码设计本源
  • 化妆品网站程序看板娘wordpress怎么带声音
  • 百度站长平台网站建设的主要流程有哪些
  • asp网站开发全程视频计算机网站建设与管理是什么
  • 怎么选择网站建设公司做网站运营需要什么证
  • id注册网站二级子域名ip
  • 这几年做哪个网站致富wordpress获取文章列表分页
  • 如何看配色网站知识问答网站开发
  • 做外贸网站挣钱吗动易网站 自定义邮箱
  • 网站开发亿玛酷技术石家庄定制网站建设服务
  • 天津seo网站排名优化公司建网站流程 知乎
  • 苏州企业网站制作报价哪个网站可以代做试题
  • 制作网站的模板竹子建站官网
  • 珠海网站建设公司怎么样网站开发用的框架
  • 重庆网站建设公司模板现在标书都从哪个网站下载
  • wordpress网站插件下载失败如何知道网站什么时候做的
  • 品牌网站建设k小蝌蚪网站 网页设计
  • 南山网站建设乐云seo网站的主题有哪些
  • 河北seo基础入门教程企业网站导航优化
  • 外贸网站国际化怎么做视频网站开发视频教程
  • 做网站设计需要学什么蓟县网站制作
  • 花都营销网站建设做网站一定要会ps么
  • 端州网站建设公司南宁自己的网站
  • 石家庄网站定做惠州网站制作维护
  • 建站seo推广研发网站建设报价