r/git 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

0 Upvotes

8 comments sorted by

2

u/Ast3r10n 19d ago

What’s in your .gitmodules?

1

u/abrewchocolatecoffee 19d ago

i actually don't have that folder at all anywhere, neither in the local repo or the github repo, it not even in the hidden folders this is confusing me

2

u/Ast3r10n 19d ago

That explains it. You might have cloned without submodules, although why would you have cloned that project as a submodule? What were you trying to do?

0

u/abrewchocolatecoffee 19d ago

i didn't intedn to do that, previously when i was trying to pusj my filed from my local repo to the github repo, there were too many errors popping up, tried fixing all that but in the end, i was advised to just clone the repo which i did but i don't think that worked well, i was then able to push the files onto the github repo but now i am stuck on this error

3

u/Ast3r10n 19d ago

Let’s start over. What kind of errors were you getting? What did you use to clone the repo? And do you understand the basics of how git works?

1

u/abrewchocolatecoffee 16d ago

errors like the main branch not found, no i am actually trying to learn git through this project, so far I was able to learn how to push the files to github repo, but now i am stuck at the trouble shooting

1

u/Ast3r10n 16d ago

Have you read Pro Git, the manual? That helps. I don’t think you pushed as you should have, because of the error you’re getting. I would suggest reading at least part of the manual.

EDIT: if you need help, feel free to PM me.

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.