时间:2025-02-26 16:14
人气:
作者:admin
Git是一个开源的分布式版本控制系统,用于敏捷高效第处理任何或小或大的项目。是Linus Torvalds 为了帮助管理Linux内核开发而开发的一个开放源码的版本控制软件。
Github是在线的基于Git的代码托管服务。GitHub是2008年由Ruby on Rails编写而成。
GitHub同时提供付费账户和免费账户。这两种账户都可以创建公开的代码仓库,只有付费账户可以创建私有的代码仓库。Gitlab解决了这个问题,可以在上面创建免费的私人repo。
GIT不仅仅是个版本控制系统,它也是个内容管理系统(CMS),工作管理系统等。
如果你是一个具有使用SVN背景的人,你需要做一定的思想转换,来适应GIT提供的一些概念和特征。
创建git仓库
git-server上的操作:
[rooteqfedu.com-]#yum install gitgit-core gitweb-y
[rooteqfedu.com~]#useraddgit
[rooteqfedu. com -] passwd git
[rooteqfedu. com -] mkdir /git-root/
[rooteqfedu. com -] cd /git-root/
[rooteqfedu. com git-root]# git init --bare shell.git ##shell名字可以改
Initialized empty Git repository in /git-root/shell.git/
注意:
git init 和 git init --bare 的区别:
使用——bare选项时,不再生成.git目录,而是只生成.git目录下面的版本历史记录文件,这些版本历史记录文件也不再存放在.git目录下面,而是直接存放在版本库的根目录下面.
用“git init”初始化的版本库用户也可以在该目录下执行所有git方面的操作。但别的用户在将更新push上来的时候容易出现冲突。
使用“git init——bare”方法创建一个所谓的裸仓库,之所以叫裸仓库是因为这个仓库只保存git历史提交的版本信息,而不允许用户在上面进行各种git操作,如果你硬要操作的话,只会得到下面的错误("This operation must be run in a work tree")这个就是最好把 远端仓库初始化成bare仓库的原因
[rooteqfedu com git-root]# chown -R git: git shell.git
[rooteqfedu. com git-root]# su -git
[giteqfedu. com -] ssh-keygen -t rsa
[giteqfedu. com -]s cd .ssh/
[giteqfedu. com ssh]s cp id_rsa. pub authorized_keys
[giteqfedu. com ssh]s vim authorized_key
[giteqfedu. com ssh]$ logout
git仓库测试
git-client上的操作
[rooteqfedu.com~]#ssh-keygen
[rooteqfedu.com-]#ssh-copy-id git@192.168.1.178
[rooteqfedu.com-]#gitclone git@192.168.1.102:/git-root/shell.git
[rooteqfedu. com ~] 1s
rh shell
[rooteqfedu com -] cd shell/
[root@qfedu.comshell]#vimtest.sh
[rooteqfedu. com shell]# git add test.sh
[rooteqfedu com shell]# git config --global user.email "youeexample. com"
[rooteqfedu. com shell]# git config --global user. name "Your Name"
[rooteqfedu com shell]# git commit -m 'first commit'
[master (root-commit) 33c5fbf] first commit
1 file changed, 2 insertions(+)
create mode 100644 test1.sh
[rooteqfedu. com shell]# git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 230 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@192.168.1.178:/git-root/shell.git
* [new branch] master - master
一般工作流程如下:
Git的工作流程示意图:



















4、 冲突解决


1、环境配置
关闭防火墙、SELinux
开启邮件服务

















用户生成公钥













Microsoft Agent Framework Skills 执行 Scripts(实
EF Core 原生 SQL 实战:FromSql、SqlQuery 与对