Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6682379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:41:57+00:00 2026-05-26T04:41:57+00:00

I have a git repository set up with several submodules, which creates a .gitmodules

  • 0

I have a git repository set up with several submodules, which creates a .gitmodules file that is a tracked file in the parent repository. However, there are other developers wanting to work on this repository, and check out the submodules. But currently the URLs for the remote submodule repositories contain my username; in the .gitmodules file it’s something like:

[submodule foo]
  path = sub/foo
  url = https://myuser@example.com/git/foo.git

Obviously other developers can’t fetch from example.com as myuser (they don’t have my password); how can I have one main repository that multiple developers can pull/push to, and allow them to have individual access to the submodules (setting up a single username they all share on the submodule host server would work, but is not good user management)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:41:57+00:00Added an answer on May 26, 2026 at 4:41 am

    If I understand correctly, you’re using HTTP basic authentication over HTTPS to allow only particular developers to access the repository. In that case, you can commit a .gitmodules that looks like:

    [submodule foo]
      path = sub/foo
      url = https://example.com/git/foo.git
    

    … i.e. without a user name, and then tell each developer to put their username and password in their ~/.netrc file. (If you’re using Windows, then there is some good advice on that here.) A simple .netrc file might look like:

    machine example.com
      login myusername
      password areamandyingtotellsomeonehiscoolpassword
    

    Update: An alternative, which doesn’t involve using .netrc, would be the following:

    Again, remove the user name from the URL in .gitmodules and commit and push that change. When someone clones the repository they would first run:

    git submodule init
    

    … which will set the config option submodule.sub/foo.url to the URL in .gitmodules. However, the init step won’t clone the submodule into place until you do git submodule update, so you can do:

    git config submodule.sub/foo.url https://myuser:mypass@example.com/git/foo.git
    

    … and then:

    git submodule update
    

    To clone the submodules with the right user name. Note that then your username and password for HTTP authentication will be stored in your git config.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a git repository which tracks an svn repository. I cloned it using
I have a git repository with multiple branches. How can I know which branches
I have a Git repository which contains a number of subdirectories. Now I have
I have a local git repository which tracks a remote SVN repository via git
I have a remote git repository setup for centralized development within my team. However,
I have a git repository (and working directory) that is stored in my Dropbox
I currently have git and virtualenv set up in a way which exactly suits
I have a repository set up on a server running Git, the repository has
I currently have Git setup with a central bare repository which is accessed by
We have a git repository managed by gitosis under Ubuntu, which has worked well

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.