Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,465,032
Community Members
 
Community Events
176
Community Groups

How does one reference a tag number in a .gitmodule file?

boonehm I'm New Here Jan 03, 2023

Ultimately, I am wanting to point a submodule in my .gitmodule to a specific tag on the repository that houses the submodule. I know you can't outright specify a "tag" attribute or list the tag in the "branch" attribute. Is there a workaround to do something like this?

In my testing, I am currently experiencing issues with testing if the url path to the tag from the source repo can be used in the "URL" attribute. In attempts to follow the steps found in this answer: https://confluence.atlassian.com/bbkb/bitbucket-cloud-fix-error-fatal-no-url-found-for-submodule-path-in-gitmodules-1188400518.html, when running 'git submodule status' I receive the error that "no submodule mapping found in .gitmodules for path 'path/name'". When running 'git rm --cached old/path', I receive the error "fatal: pathspec 'old/path' did not match any files, although I have only used one path name for this submodule. Since that didn't seem to work, the step to update submodules once again, of course, fails still, stating that there is no url found for the "old/path" even though it claims the path name cannot be found in the pathspec, it is as if it is still referencing the path name.

1 answer

0 votes

Hi @boonehm and welcome to the community!

I don't think that a url in .gitmodules set to something like https://bitbucket.org/my-workspace/my-repo/commits/tag/1.4 is going to work. This is not a valid url for cloning a submodule.

A tag is always associated with a specific commit. A branch is a pointer to a commit.
You can create a new branch out of the commit that the tag is pointing to with:

git checkout -b NEW_BRANCH_NAME COMMIT_HASH

and then use that's branch's name in the "branch" attribute in .gitmodules.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events