Docker centos 7 swift build error

mkdir demo
cd demo
docker run --rm -it -v $(pwd):/app -w /app swift:5.2.5-centos7 bash
[root@62fd358f5a3c app]# git clone https://github.com/apple/example-package-dealer
[root@62fd358f5a3c app]# cd example-package-dealer/
[root@62fd358f5a3c example-package-dealer]# swift build
Updating https://github.com/apple/example-package-playingcard.git
Updating https://github.com/apple/example-package-deckofplayingcards.git
error: terminated(129): SWIFT_WEBROOT=https://swift.org/builds/ OLDPWD=/app HOSTNAME=62fd358f5a3c TERM=xterm SWIFT_BRANCH=swift-5.2.5-release PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin _=/usr/bin/swift GIT_TERMINAL_PROMPT=0 SWIFT_PLATFORM=centos7 LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40=;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36: SWIFT_VERSION=swift-5.2.5-RELEASE HOME=/root SWIFT_SIGNING_KEY=A62AE125BBBFBB96A6E042EC925CC1CCED3D1561 LESSOPEN=||/usr/bin/lesspipe.sh %s GIT_SSH_COMMAND=ssh -oBatchMode=yes PWD=/app/example-package-dealer SHLVL=1 git -C /app/example-package-dealer/.build/repositories/example-package-deckofplayingcards-7c0a2312 remote update -p output:
    Unknown option: -C
    usage: git [--version] [--help] [-c name=value]
               [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
               [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
               [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
               <command> [<args>]
    
Fetching https://github.com/apple/example-package-fisheryates.git
[root@62fd358f5a3c example-package-dealer]#

It is because the git version of CentOS 7 repo is 1.x, and Swift requires git 2.x.

You may use the following commands to install git 2.24 as a workaround:

yum uninstall git -y
yum install https://repo.ius.io/ius-release-el7.rpm -y
yum install git224 -y

Okay thank you.

Terms of Service

Privacy Policy

Cookie Policy