user3339128
user3339128

Reputation: 139

Submodules not clickable in github

I am using github and I have submodules in my repo. However, I would like to be able to click on the submodules on github to open the submodules repo page. This is my .gitmodules file.

[submodule "submodule1"]
        path = submodule1
        url = https://github.com/octocat/Hello-World
[submodule "submodule2"]
        path = submodule2
        url = https://github.com/octocat/hello-worId
[submodule "submodule3"]
        path = submodule3
        url = https://github.com/octocat/hello-worId

GitHub submodules

Is there anything I can do to get the submodules clickable on github?

Upvotes: 5

Views: 4446

Answers (4)

anurag chandra
anurag chandra

Reputation: 11

I might be late, but wanted to add another possible reason.

I faced the same issue. In my case I had used the SSH url:

[email protected]:<user-name>/<repo-name>.git

And this led to use the same URL in the .gitmodules file:

[submodule "Project6"]
    path = Project6
    url = [email protected]:<user-name>/<repo-name>.git

After changing the url to following in the .gitmodules file

url = https://github.com/<user-name>/<repo-name>

Upvotes: 0

VonC
VonC

Reputation: 1329032

Another case where submodule were not clickable if when their URL is a relative path (not the case in the OP)

This is no longer an issue in March 2021:

Hyperlink support for submodules with relative paths

Submodules defined with relative paths are now clickable in the web UI, making it easy to navigate to linked repositories. Previously, only submodules with absolute URLs were clickable.

Only relative paths following the format ../{repo} (a repository with the same owner) or ../{owner}/{repo} (a repository with a different owner) are supported.

To learn more about submodules, see Working with submodules on the GitHub blog.

Upvotes: 1

Mikescher
Mikescher

Reputation: 893

Another cause of trouble can be the directory separator:
If you add a submodule under windows you get an entry in your .gitmodules that looks like this:

[submodule "Source\\External\\Library"]
    path = Source\\External\\Library
    url = https://github.com/Username/Library.git

but for github to recognize the submodule you have to change it to this:

[submodule "Source\\External\\Library"]
    path = Source/External/Library
    url = https://github.com/Username/Library.git

Be careful not to change the first line, otherwise the entry will suddenly point to another (non-existent) submodule

Upvotes: 1

user3339128
user3339128

Reputation: 139

GitHub Enterprise does not link submodules that are not located on the same appliance, in the same way as GitHub.com does not link submodules that are not located on GitHub.com. So, linking does not work from github enterprise to github.com. Thanks for all the help.

Upvotes: 5

Related Questions