To use git on opkg powered systems is simple, opkg install git gives you a copy of git. However, if you are going to use git with SSH URL, or use commands like git submodule, you might get into problems…

Using git with SSH URL

To use git with SSH URL, the default SSH client provided by dropbear is usually not enough, and you may encounter errors when cloning git repositories. For example,

ssh: Exited: String too long
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Solution

So we need a more comprehensive implementation of the SSH protocol. To achieve that we can install the openssh-client package.

opkg install openssh-client

Unable to find remote helper for 'https'

If you added submodules from a https url, and want to init and update them, you might come across this:

[[email protected] git]$ git submodule update --init
Cloning into 'submodule'...
fatal: Unable to find remote helper for 'https'

In this case, you need to install git-http, which allows git push/fetch over http(s) and ftp(s).

Solution

opkg install git-http

The "Not Found" Problem

For example,

[[email protected] git]$ git submodule update --init
/opt/lib/git-core/git-submodule: line 1: /usr/bin/perl: not found
/opt/lib/git-core/git-submodule: line 1: /usr/bin/perl: not found

At the first sight, it seemed to be perl not installed. But opkg install perl gave the following output:

[[email protected] git]$ opkg install perl
Package perl (5.22.1-2) installed in root is up to date.

And which perl gave:

[[email protected] git]$ which perl
/opt/bin/perl

So perl was installed, and was installed as /opt/bin/perl instead of /usr/bin/perl in this case.

Solution

To solve this problem, edit the file mentioned in the warning, search and replace /usr/bin/perl with its actual location.

Alternatively, make a symbolic link to its actual location as /usr/bin/perl. Note this may not work as /usr might be read-only on those opkg powered embedded devices.

'sh-i18n–envsubst' is not a git command

[[email protected] git]$ git submodule update --init
git: 'sh-i18n--envsubst' is not a git command. See 'git --help'.
git: 'sh-i18n--envsubst' is not a git command. See 'git --help'.

git sh-i18n–envsubst is Git's stripped-down copy of the GNU envsubst(1) program that comes with the GNU gettext package. It's used internally by git-sh-i18n(1) to interpolate the variables passed to the eval_gettext function.

Fortunately, you can simply ignore this, and everything else just still works.