采用版本是2.30.0
20240924 重新编译时,采用了指定版本的 openssl
下载、解压、编译、安装:
1 2 3 4 5 6 |
wget --no-check-certificate https://www.kernel.org/pub/software/scm/git/git-2.30.0.tar.gz tar -zvxf git-2.30.0.tar.gz cd git-2.30.0 ./configure --prefix=/usr/local/git --with-openssl=/usr/local/openssl make all sudo make install |
编译报错:
curl.h缺失:
http.h:6:10: fatal error: curl/curl.h: No such file or directory
#include <curl/curl.h>
1 |
yum -y install curl-devel |
expat.h缺失:
http-push.c:22:10: fatal error: expat.h: No such file or directory
#include <expat.h>
1 |
yum install expat-devel |
https://blog.csdn.net/weixin_41910427/article/details/82733265
P.s. 我是采用rpm包下载的方案:
https://centos.pkgs.org/7/centos-x86_64/expat-devel-2.1.0-12.el7.x86_64.rpm.html
ssl.h 缺失:
git-compat-util.h:301:25: fatal error: openssl/ssl.h: No such file or directory
1 |
sudo yum install openssl-devel |
20240924 tkxiong 修改—— 在configure命令时就指定了openssl的地址,就不会出现该问题。
1 |
--with-openssl=/usr/local/openssl |
zlib.h 缺失:
1 |
sudo yum install -y zlib-devel |
将Git路径加入到环境变量
1 2 3 4 |
vim /etc/profile # Git export PATH=$PATH:/usr/local/git/bin |
Git常用命令记录:
更新远端分支列表:
1 |
git remote update origin --prune |
本地分支去掉远端分支绑定
1 |
git branch --unset-upstream |
回退版本:
1 |
git reset --hard <commit_id> |
添加远端分支
1 |
git remote add <newname> <url> |
开发合并基本操作:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
1. 更新dev分支代码 git pull origin dev 2. 拉出新分支 git checkout -b feature/xxx coding 3. git add filexxx 4. git commit -m"..." 5. git checkout dev 6. git pull origin dev 7. git checkout feature/xxx 8. 将dev分支合并到当前分支, 解决代码冲突: git merge dev 9. 提交到远端 git push origin feature/xxx 10.从远端发起MergeRequest, 合并代码 |
Git记住凭据
1 2 3 4 5 6 7 8 |
# 设置临时缓存, 默认缓存15分钟 git config --global credential.helper cache # 设置记住密码的超时时间,例如1小时(3600秒) git config --global credential.helper 'cache --timeout=3600' # 设置永久存储 git config --global credential.helper store |
…
【Git】升级最新版本 && git 常用命令记录