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,560,408
Community Members
 
Community Events
185
Community Groups

How to clone repository with submodules

Edited

I have a repo with submodules. I need to access it via https.

The .gitmodules file has this format:

[submodule "submodules/sm1"]
path = submodules/sm1
url = https://bitbucket.org/WORKSPACE/REPO

So if I git submodule update --init, it asks me for a user name (which disallows this from being a non-interactive session, which is pointless)

If I put the user within the url (as mentioned in https://support.atlassian.com/bitbucket-cloud/docs/using-app-passwords/), then I can use GIT_ASKPASS to do a git clone in a scriptable way.

But I don't want to use to put a specific and concrete user within the url in a submodule.

Is there a way to keep the .gitmodules file clean without any ad-hoc username, so I can share a repo between several developers; and also, clone it with its submodules in a scriptable way? None of the previous messages work, they always end up in git complaining about not having access rights.

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 09, 2022

Hi Francisco,

Is it a requirement to use HTTPS?

If so, please let me know, I'll need some time to look into it.

 

In case you are ok with using SSH instead, you can use an SSH URL for the repo in the .gitmodules file

[submodule "submodules/sm1"]
path = submodules/sm1
url = git@bitbucket.org:WORKSPACE/REPO.git

SSH URLs do not include a username and authentication is done with SSH keys. This would require users to set up SSH Bitbucket Cloud (if they haven't already), and then authentication for each user will be done with the SSH keys each user has on their own computer.

After setting up an SSH, each user can create a file named config in their ~/.ssh folder with the following configuration, to ensure that the SSH key they generated is used when they connect to bitbucket.org:

Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile /Users/myUser/.ssh/id_rsa
IdentitiesOnly yes

where /Users/myUser/.ssh/id_rsa is the path to the private SSH key in the user's computer.

 

If you're using a script, you would need to have an SSH key pair on the machine where the script is running. If the script is used to only clone/pull, you could set up Access keys: https://support.atlassian.com/bitbucket-cloud/docs/add-access-keys/

Otherwise, you would need the SSH keys of a user with access to the repo.

 

If you have any questions, please feel free to let me know.

Just a heads up, I moved your post to a new question. It's best to create a separate question if you need assistance with something, as a new question will have visibility to the rest of my team if I'm out of office, and also because a certain question can become difficult to follow if we try to troubleshoot multiple users' issues.

 

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events