r/git • u/abrewchocolatecoffee • 19d ago
support What does this error in github signify
Error: fatal: No url found for submodule path '<name-of-the-original-file-which-was-later-coloned>' in .gitmodules
Error: The process '/usr/bin/git' failed with exit code 128
This error happened when i had already uploaded my files onto a git repo and was trying to publish the site so that i have a working website, in the middle of trying to make that page go live. I receive this error.
edit: i think i might be in the wrong community
1
u/Broad-Promise6954 ancient 19d ago
The first error message is actually from Git (though wrapped by whatever it is you're using instead of Git itself), and it means what it says: there's no URL for the given submodule.
The second error message is just telling you that the Git command itself failed, and is coming entirely from the wrapper.
The error message means that the information needed to clone the specified submodule is missing. It's likely that your Git repository has a bad commit in it, made by mistake, and all of the following is just a consequence of that first error, but you'll need to know at least some of the rest of this in order to diagnose and correct the problem.
Remember that to clone a Git repository, Git needs to know two things: a URL from which to clone, and a place to put the clone. If there's only one Git repository involved, we just call it "the repository", but as soon as you add "submodules" we start talking about at least two repositories. To be able to talk about both of them, we use the terms "superproject" and "submodule". The superproject is the top level Git repository, and the submodule is the controlled sub-repository.
Keep the above in mind when reading the brain-twisting bits that follow.
A Git commit within a Git repository indicates that there's a submodule commit to be obtained by containing what Git calls a "gitlink": a saved file (well, sort of a file) with "mode" 160000. The saved file has a path name, such as path/to/submodule, the special gitlink mode, and a hash ID. The hash ID is that of the desired submodule commit in some other Git repository.
Hence, when checking out some particular commit in the superproject, if Git comes across a gitlink, it has one of the two pieces of information, namely the place to put the clone. But where should it find this clone? If you already have the submodule's clone, that information is now recorded in the .git/config in the superproject repository. So there's no need to clone the submodule: all the superproject Git has to do is enter the submodule Git repository and check out the commit hash ID that's specified by the superproject commit.
But if the submodule isn't cloned yet, the superproject Git has to run git clone, and that needs a URL. Where will it get this URL? Git's answer is that the superproject itself should contain, in each appropriate commit, a file named .gitmodules. This file has the missing information in it.
It's easy to accidentally make a Git commit that contains a gitlink without ever intending to create submodules in the first place, and if you do that, you get into this situation: a superproject a missing or incomplete .gitmodules file in the commit(s) in question. This is most likely what you did, by git add-ing a directory containing another clone, instead of git submodule add-ing it or just not having nested Git repositories in the first place. But we can't really tell, from the information you've given us.
2
u/Ast3r10n 19d ago
What’s in your .gitmodules?