确认环境变量是否有git 配置
1、如果没有,则依次执行以下命令
- cd ~ ,进入用户根目录
- vi .bashrc ,打开 bash 文件
- 在文件最后,追加 以下 两个环境变成
export PATH=$PATH:/usr/local/git/bin
export PATH=$PATH:/usr/local/git/libexec/git-core
- 执行,source .bashrc ,注意:如果不执行该命令,则修改的环境变量,要服务器重启后,才会生效
2、如果环境变量,存在且正常,则按以下步骤检查
- 进入 /usr/local/git/libexec/git-core
- 检查目录中,中否存在 git-remote-https
- 如果不存在,则说明 是因为可执行文件中,不存在 git-remote-https ,导致无反使用git clone https://*****
- 依次执行以下命令 (该过程比较慢)
cd git-2.9.5 ,注:该目录是,git 压缩包的解压目录
./configure --prefix=/usr/local/git
make && make install
- 重新进入 /usr/local/git/libexec/git-core ,检查 是否存在 git-remote-https,如果存在则表示正常
- 重新执行git clone https://github.com/open-source-parsers/jsoncpp.git
- 可以正常获取代码
![]()