Solve repo sync ( git ) error: git: 'remote-https' is not a git command

Phenomenon

When downloading the Android source code on Ubuntu 18.04, an error is reported: git: 'remote-https' is not a git command.

$ repo init -u https://android.googlesource.com/platform/manifest -b master
Get https://gerrit.googlesource.com/git-repo/clone.bundle
Get https://gerrit.googlesource.com/git-repo
git: 'remote-https' is not a git command. See 'git --help'.

apt upgrade cannot resolve file

Using the apt command to upgrade git to the latest version does not solve this problem.

work-around

Using GitHub or the domestic git service, it is possible to download the code with ssh, but the HTTPS method will report the same error.

# ok
$ git clone [email protected]:git/git.git

# error
$ git clone https://github.com/git/git.git

solution

Download the git source code and compile it locally:

$ git clone [email protected]:git/git.git
$ make

It is said on the Internet that the libcurl4-openssl-dev package is required to compile git-remote-https. My computer is already installed, not sure if this dependency is necessary.

After the compilation is complete, generate the file: git-remote-https, copy it to the directory where the git command is located (or add it to the path)

$  ll git-remote-http*
-rwxrwxr-x 4 dev dev 12796440 324 12:40 git-remote-https*
$ which git
/usr/local/bin/git
$ sudo cp git-remote-https /usr/local/bin/

Download the code again, no more errors.

Never had this problem before, not sure why. Don't know if it has something to do with the Ubuntu version.
Students who specify the reason, please remind me.

Guess you like

Origin blog.csdn.net/yinminsumeng/article/details/129748802