git

Problems encountered when cloning submodules in a GitHub project

GitHub is truly a treasure trove of open source, not only for learning code but also for learning how to use git!

Recently I studied the Off‑the‑Record‑iOS project (https://github.com/chrisballinger/Off-the-Record-iOS) and practiced using git submodules.

This project has a Submodules folder containing other open source projects it depends on. At first I did not notice, and just downloaded the ZIP. In XCode many file names showed up in red, revealing missing dependencies. There were quite a few, so I abandoned manual downloading.

Searching, I found issue #87 where someone asked the same question: https://github.com/chrisballinger/Off-the-Record-iOS/issues/87. Following the answer, I cloned the project with git and ran git submodule init && git submodule update (for git 1.6 and later you can use git clone –recursive). Updating worked for the first few submodules, but then a new error appeared:

Submodule path ‘Submodules/DAKeyboardControl’: checked out ‘5352d1ff2d1131d974d94406ed8fcf8eb068aa72’
Cloning into ‘Submodules/LibOrange’…
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Clone of ‘git@github.com:ChatSecure/LibOrange.git’ into submodule path ‘Submodules/LibOrange’ failed

Continue reading…

One cause of GitLab built‑in CI runner submodule initialization error

First, the background: a GitLab project that references other projects within the same GitLab instance using submodules. The .gitmodules file looks something like this:

[submodule "lib1"]
	path = lib1
	url = http://gitlab.xxx.xxx/group1/lib1.git
[submodule "lib2"]
	path = lib2
	url = http://gitlab.xxx.xxx/group2/lib2.git
[submodule "lib3"]
	path = lib3
	url = http://gitlab.xxx.xxx/group3/lib3.git

This structure works fine during local development. Of course, the local GitLab account has access permissions to the dependent submodule repositories. When setting up the CI build environment, using GitLab’s docker runner on Linux works without issues. However, on macOS using the shell runner, I encountered errors when initializing submodules:

Continue reading…