yumとともにインストールされたgitのバージョンが低すぎます。
git --version
git version 1.7.1
次に、zshをインストールし、次のエラーを報告しました。
% ./install.sh
Cloning Oh My Zsh...
error: unknown switch `c'
usage: git clone [options] [--] <repo> [<dir>]
-v, --verbose be more verbose
-q, --quiet be more quiet
--progress force progress reporting
-n, --no-checkout don't create a checkout
--bare create a bare repository
--mirror create a mirror repository (implies bare)
-l, --local to clone from a local repository
--no-hardlinks don't use local hardlinks, always copy
-s, --shared setup as shared repository
--recursive initialize submodules in the clone
--template <path> path the template repository
--reference <repo> reference repository
-o, --origin <branch>
use <branch> instead of 'origin' to track upstream
-b, --branch <branch>
checkout <branch> instead of the remote's HEAD
-u, --upload-pack <path>
path to git-upload-pack on the remote
--depth <depth> create a shallow clone of that depth
Error: git clone of oh-my-zsh repo failed
上記のエラーは低gitバージョンが原因であると思われます。
gitをダウンロードしてインストールします
公式ダウンロードページは次のとおりです:https:
//git-scm.com/download/linux
ダウンロードしたバージョンは次のとおりです:https:
//www.kernel.org/pub/software/scm/git/git-2.31.0.tar.gz
インストールに依存するメーカーが使用されます
yum -y install autoconf
yum -y install gcc gcc-c++ libstdc++-devel
yum install openssl-devel
インストール
#解压
tar -zxvf git-2.31.0.tar.gz
cd git-2.31.0
make configure
./configure --prefix=/usr/local/git
make profix=/usr/local/git
make install
これでインストールは完了です。
環境変数を構成する
例としてzshを取り上げます
vim ~/.zshrc
次の行を追加します
export PATH=/usr/local/git/bin:$PATH
環境変数をすぐに有効にする
source ~/.zshrc
gitバージョンのクエリ
git --version
git version 2.31.0
新しいバージョンのインストールが完了しました。