【C++】环境搭建CentOS Clion报错Unsupported git Version 1.8.3.1

2024-05-09 06:12

本文主要是介绍【C++】环境搭建CentOS Clion报错Unsupported git Version 1.8.3.1,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

【C++】环境搭建Clion-Unsupported git Version 1.8.3.1

    • Git升级步骤
      • 1.卸载旧版本
      • 2.安装依赖
      • 3.下载git最新版本包
      • 4.解压git文件包
      • 5.编译文件
      • 5.将git加入环境变量
      • 6.验证git版本

请添加图片描述

如上图所示,报错Unsupported git Version 1.8.3.1 At least 2.17.0 is required

报错意思如下:
当前git版本为1.8.3.1最低要求版本为2.17.0

现在我们要做的事就是升级git版本,步骤如下:

1.卸载旧版本
2.安装依赖
3.下载git最新版本包
4.解压git文件包
5.编译文件
5.将git加入环境变量
6.验证git版本

Git升级步骤

1.卸载旧版本

执行如下命令:

sudo yum remove git

演示如下

[root@localhost KingbaseManagerTools]# sudo yum remove git
已加载插件:fastestmirror
正在解决依赖关系
--> 正在检查事务
---> 软件包 git.x86_64.0.1.8.3.1-25.el7_9 将被 删除
--> 正在处理依赖关系 git = 1.8.3.1-25.el7_9,它被软件包 perl-Git-1.8.3.1-25.el7_9.noarch 需要
--> 正在检查事务
---> 软件包 perl-Git.noarch.0.1.8.3.1-25.el7_9 将被 删除
--> 解决依赖关系完成依赖关系解决=====================================================================================================================================================================================================Package                                       架构                                        版本                                                  源                                             大小
=====================================================================================================================================================================================================
正在删除:git                                           x86_64                                      1.8.3.1-25.el7_9                                      @updates                                       22 M
为依赖而移除:perl-Git                                      noarch                                      1.8.3.1-25.el7_9                                      @updates                                       57 k事务概要
=====================================================================================================================================================================================================
移除  1 软件包 (+1 依赖软件包)安装大小:22 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction正在删除    : perl-Git-1.8.3.1-25.el7_9.noarch                                                                                                                                                 1/2 正在删除    : git-1.8.3.1-25.el7_9.x86_64                                                                                                                                                      2/2 验证中      : git-1.8.3.1-25.el7_9.x86_64                                                                                                                                                      1/2 验证中      : perl-Git-1.8.3.1-25.el7_9.noarch                                                                                                                                                 2/2 删除:git.x86_64 0:1.8.3.1-25.el7_9                                                                                                                                                                      作为依赖被删除:perl-Git.noarch 0:1.8.3.1-25.el7_9                                                                                                                                                                 完毕!

2.安装依赖

执行如下命令:

sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

演示如下:

[root@localhost KingbaseManagerTools]# sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.ustc.edu.cn* extras: mirrors.ustc.edu.cn* updates: mirrors.ustc.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 expat-devel.x86_64.0.2.1.0-15.el7_9 将被 安装
--> 正在处理依赖关系 expat = 2.1.0-15.el7_9,它被软件包 expat-devel-2.1.0-15.el7_9.x86_64 需要
---> 软件包 gettext-devel.x86_64.0.0.19.8.1-3.el7 将被 安装
--> 正在处理依赖关系 gettext-common-devel = 0.19.8.1-3.el7,它被软件包 gettext-devel-0.19.8.1-3.el7.x86_64 需要
--> 正在处理依赖关系 git,它被软件包 gettext-devel-0.19.8.1-3.el7.x86_64 需要
....验证中      : krb5-libs-1.15.1-50.el7.x86_64                                                                                                                                                 30/30 已安装:expat-devel.x86_64 0:2.1.0-15.el7_9  gettext-devel.x86_64 0:0.19.8.1-3.el7  libcurl-devel.x86_64 0:7.29.0-59.el7_9.2  openssl-devel.x86_64 1:1.0.2k-26.el7_9  zlib-devel.x86_64 0:1.2.7-21.el7_9 作为依赖被安装:gettext-common-devel.noarch 0:0.19.8.1-3.el7           git.x86_64 0:1.8.3.1-25.el7_9               keyutils-libs-devel.x86_64 0:1.5.8-3.el7           krb5-devel.x86_64 0:1.15.1-55.el7_9          libcom_err-devel.x86_64 0:1.42.9-19.el7                libkadm5.x86_64 0:1.15.1-55.el7_9           libselinux-devel.x86_64 0:2.5-15.el7               libsepol-devel.x86_64 0:2.5-10.el7           libverto-devel.x86_64 0:0.2.5-4.el7                    pcre-devel.x86_64 0:8.32-17.el7             perl-Git.noarch 0:1.8.3.1-25.el7_9                作为依赖被升级:curl.x86_64 0:7.29.0-59.el7_9.2            expat.x86_64 0:2.1.0-15.el7_9      krb5-libs.x86_64 0:1.15.1-55.el7_9      libcurl.x86_64 0:7.29.0-59.el7_9.2      openssl.x86_64 1:1.0.2k-26.el7_9     openssl-libs.x86_64 1:1.0.2k-26.el7_9      zlib.x86_64 0:1.2.7-21.el7_9      完毕!

3.下载git最新版本包

查看git官网查看最新版本:(附GIT官网地址如下)
git官方网站

请添加图片描述

这里看到最新版本为2.45.0

下载到/usr/src 目录下

[root@localhost KingbaseManagerTools]# cd /usr/src
[root@localhost src]# wget https://www.kernel.org/pub/software/scm/git/git-2.45.0.tar.gz
bash: wget: 未找到命令

如上所示:报错了我们缺少了wget下载组建
解决方法如下:

yum install -y wget

演示如下:

[root@localhost src]# yum install -y wget
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.ustc.edu.cn* extras: mirrors.ustc.edu.cn* updates: mirrors.ustc.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 wget.x86_64.0.1.14-18.el7_6.1 将被 安装
--> 解决依赖关系完成依赖关系解决=====================================================================================================================================================================================================Package                                     架构                                          版本                                                    源                                           大小
=====================================================================================================================================================================================================
正在安装:wget                                        x86_64                                        1.14-18.el7_6.1                                         base                                        547 k事务概要
=====================================================================================================================================================================================================
安装  1 软件包总下载量:547 k
安装大小:2.0 M
Downloading packages:
wget-1.14-18.el7_6.1.x86_64.rpm                                                                                                                                               | 547 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction正在安装    : wget-1.14-18.el7_6.1.x86_64                                                                                                                                                      1/1 验证中      : wget-1.14-18.el7_6.1.x86_64                                                                                                                                                      1/1 已安装:wget.x86_64 0:1.14-18.el7_6.1                                                                                                                                                                      完毕!

安装完成,接下来我们继续下载git

执行命令

wget https://www.kernel.org/pub/software/scm/git/git-2.45.0.tar.gz

示例如下:

[root@localhost src]# wget https://www.kernel.org/pub/software/scm/git/git-2.45.0.tar.gz
--2024-05-09 00:56:02--  https://www.kernel.org/pub/software/scm/git/git-2.45.0.tar.gz
正在解析主机 www.kernel.org (www.kernel.org)... 145.40.73.55, 2604:1380:40e1:4800::1
正在连接 www.kernel.org (www.kernel.org)|145.40.73.55|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 301 Moved Permanently
位置:https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.45.0.tar.gz [跟随至新的 URL]
--2024-05-09 00:56:05--  https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.45.0.tar.gz
正在解析主机 mirrors.edge.kernel.org (mirrors.edge.kernel.org)... 147.75.48.161, 2604:1380:40f1:3f00::1
正在连接 mirrors.edge.kernel.org (mirrors.edge.kernel.org)|147.75.48.161|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:11106279 (11M) [application/x-gzip]
正在保存至: “git-2.45.0.tar.gz”100%[===========================================================================================================================================================>] 11,106,279   839KB/s 用时 7.6s   2024-05-09 00:56:15 (1.39 MB/s) - 已保存 “git-2.45.0.tar.gz” [11106279/11106279])

查看下载的文件是否存在

[root@localhost src]# ls -l
总用量 10848
drwxr-xr-x. 2 root root        6 411 2018 debug
-rw-r--r--. 1 root root 11106279 430 00:54 git-2.45.0.tar.gz
drwxr-xr-x. 2 root root        6 411 2018 kernels
[root@localhost src]# 

这里我们已经看到下载了一个名为git-2.45.0.tar.gz的文件

4.解压git文件包

sudo tar xzf git-2.45.0.tar.gz

示例如下:

[root@localhost src]# sudo tar xzf git-2.45.0.tar.gz 
[root@localhost src]# ls -l
总用量 10880
drwxr-xr-x.  2 root root        6 411 2018 debug
drwxrwxr-x. 28 root root    16384 430 00:19 git-2.45.0
-rw-r--r--.  1 root root 11106279 430 00:54 git-2.45.0.tar.gz
drwxr-xr-x.  2 root root        6 411 2018 kernels
[root@localhost src]# 

5.编译文件

执行如下命令:

cd git-2.45.0
sudo make prefix=/usr/local all
sudo make prefix=/usr/local install

遇到报错如下:

[root@localhost src]# cd git-2.45.0
[root@localhost git-2.45.0]# sudo make prefix=/usr/local all
GIT_VERSION = 2.45.0* new build flagsGEN command-list.hGEN config-list.hGEN hook-list.hCC oss-fuzz/dummy-cmd-main.o
/bin/sh: cc: 未找到命令

原因是缺少了GCC编译文件,可以通过如下命令安装

sudo yum install gcc

安装完成后再次执行编译

sudo make prefix=/usr/local all
sudo make prefix=/usr/local install

到这里可以正常编译完成了

          cp "$bindir/git" "$bindir/$p" || exit; }; \
done && \
for p in  git-add git-am git-annotate git-apply git-archive git-bisect git-blame git-branch git-bugreport git-bundle git-cat-file git-check-attr git-check-ignore git-check-mailmap git-check-ref-format git-checkout--worker git-checkout-index git-checkout git-clean git-clone git-column git-commit-graph git-commit-tree git-commit git-config git-count-objects git-credential-cache--daemon git-credential-cache git-credential-store git-credential git-describe git-diagnose git-diff-files git-diff-index git-diff-tree git-diff git-difftool git-fast-export git-fast-import git-fetch-pack git-fetch git-fmt-merge-msg git-for-each-ref git-for-each-repo git-fsck git-fsmonitor--daemon git-gc git-get-tar-commit-id git-grep git-hash-object git-help git-hook git-index-pack git-init-db git-interpret-trailers git-log git-ls-files git-ls-remote git-ls-tree git-mailinfo git-mailsplit git-merge-base git-merge-file git-merge-index git-merge-ours git-merge-recursive git-merge-tree git-merge git-mktag git-mktree git-multi-pack-index git-mv git-name-rev git-notes git-pack-objects git-pack-redundant git-pack-refs git-patch-id git-prune-packed git-prune git-pull git-push git-range-diff git-read-tree git-rebase git-receive-pack git-reflog git-remote-ext git-remote-fd git-remote git-repack git-replace git-replay git-rerere git-reset git-rev-list git-rev-parse git-revert git-rm git-send-pack git-shortlog git-show-branch git-show-index git-show-ref git-sparse-checkout git-stash git-stripspace git-submodule--helper git-symbolic-ref git-tag git-unpack-file git-unpack-objects git-update-index git-update-ref git-update-server-info git-upload-archive git-upload-pack git-var git-verify-commit git-verify-pack git-verify-tag git-worktree git-write-tree git-cherry git-cherry-pick git-format-patch git-fsck-objects git-init git-maintenance git-merge-subtree git-restore git-show git-stage git-status git-switch git-version git-whatchanged; do \rm -f "$execdir/$p" && \if test -z ""; \then \test -n "" && \ln -s "$destdir_from_execdir_SQ/bin/git" "$execdir/$p" || \{ test -z "" && \ln "$execdir/git" "$execdir/$p" 2>/dev/null || \ln -s "git" "$execdir/$p" 2>/dev/null || \cp "$execdir/git" "$execdir/$p" || exit; }; \fi \
done && \
remote_curl_aliases="git-remote-https git-remote-ftp git-remote-ftps" && \
for p in $remote_curl_aliases; do \rm -f "$execdir/$p" && \test -n "" && \ln -s "git-remote-http" "$execdir/$p" || \{ test -z "" && \ln "$execdir/git-remote-http" "$execdir/$p" 2>/dev/null || \ln -s "git-remote-http" "$execdir/$p" 2>/dev/null || \cp "$execdir/git-remote-http" "$execdir/$p" || exit; } \
done
[root@localhost git-2.45.0]# 

5.将git加入环境变量

echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bashrc
source ~/.bashrc

6.验证git版本

git --version

示例如下:

[root@localhost git-2.45.0]# echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bashrc
[root@localhost git-2.45.0]# source ~/.bashrc
[root@localhost git-2.45.0]# git --version
git version 2.45.0

到这里git就升级完成了

这篇关于【C++】环境搭建CentOS Clion报错Unsupported git Version 1.8.3.1的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/972599

相关文章

C++初始化数组的几种常见方法(简单易懂)

《C++初始化数组的几种常见方法(简单易懂)》本文介绍了C++中数组的初始化方法,包括一维数组和二维数组的初始化,以及用new动态初始化数组,在C++11及以上版本中,还提供了使用std::array... 目录1、初始化一维数组1.1、使用列表初始化(推荐方式)1.2、初始化部分列表1.3、使用std::

C++ Primer 多维数组的使用

《C++Primer多维数组的使用》本文主要介绍了多维数组在C++语言中的定义、初始化、下标引用以及使用范围for语句处理多维数组的方法,具有一定的参考价值,感兴趣的可以了解一下... 目录多维数组多维数组的初始化多维数组的下标引用使用范围for语句处理多维数组指针和多维数组多维数组严格来说,C++语言没

Python Jupyter Notebook导包报错问题及解决

《PythonJupyterNotebook导包报错问题及解决》在conda环境中安装包后,JupyterNotebook导入时出现ImportError,可能是由于包版本不对应或版本太高,解决方... 目录问题解决方法重新安装Jupyter NoteBook 更改Kernel总结问题在conda上安装了

Python安装时常见报错以及解决方案

《Python安装时常见报错以及解决方案》:本文主要介绍在安装Python、配置环境变量、使用pip以及运行Python脚本时常见的错误及其解决方案,文中介绍的非常详细,需要的朋友可以参考下... 目录一、安装 python 时常见报错及解决方案(一)安装包下载失败(二)权限不足二、配置环境变量时常见报错及

c++中std::placeholders的使用方法

《c++中std::placeholders的使用方法》std::placeholders是C++标准库中的一个工具,用于在函数对象绑定时创建占位符,本文就来详细的介绍一下,具有一定的参考价值,感兴... 目录1. 基本概念2. 使用场景3. 示例示例 1:部分参数绑定示例 2:参数重排序4. 注意事项5.

使用C++将处理后的信号保存为PNG和TIFF格式

《使用C++将处理后的信号保存为PNG和TIFF格式》在信号处理领域,我们常常需要将处理结果以图像的形式保存下来,方便后续分析和展示,C++提供了多种库来处理图像数据,本文将介绍如何使用stb_ima... 目录1. PNG格式保存使用stb_imagephp_write库1.1 安装和包含库1.2 代码解

CentOS系统Maven安装教程分享

《CentOS系统Maven安装教程分享》本文介绍了如何在CentOS系统中安装Maven,并提供了一个简单的实际应用案例,安装Maven需要先安装Java和设置环境变量,Maven可以自动管理项目的... 目录准备工作下载并安装Maven常见问题及解决方法实际应用案例总结Maven是一个流行的项目管理工具

本地搭建DeepSeek-R1、WebUI的完整过程及访问

《本地搭建DeepSeek-R1、WebUI的完整过程及访问》:本文主要介绍本地搭建DeepSeek-R1、WebUI的完整过程及访问的相关资料,DeepSeek-R1是一个开源的人工智能平台,主... 目录背景       搭建准备基础概念搭建过程访问对话测试总结背景       最近几年,人工智能技术

C++实现封装的顺序表的操作与实践

《C++实现封装的顺序表的操作与实践》在程序设计中,顺序表是一种常见的线性数据结构,通常用于存储具有固定顺序的元素,与链表不同,顺序表中的元素是连续存储的,因此访问速度较快,但插入和删除操作的效率可能... 目录一、顺序表的基本概念二、顺序表类的设计1. 顺序表类的成员变量2. 构造函数和析构函数三、顺序表

使用C++实现单链表的操作与实践

《使用C++实现单链表的操作与实践》在程序设计中,链表是一种常见的数据结构,特别是在动态数据管理、频繁插入和删除元素的场景中,链表相比于数组,具有更高的灵活性和高效性,尤其是在需要频繁修改数据结构的应... 目录一、单链表的基本概念二、单链表类的设计1. 节点的定义2. 链表的类定义三、单链表的操作实现四、