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 7961517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:03:36+00:00 2026-06-04T05:03:36+00:00

I never expect renaming a git repo, which, more specifically, is the top-level folder

  • 0

I never expect renaming a git repo, which, more specifically, is the top-level folder holds the project, would be so hard. Yes, the project containing some submodules, but it is the top-level folder that needs renaming, not the submodule folder. Git, it seems, records some odd absolute paths in its submodule mechanisms.

Let’s assume that

  1. All your projects locate in /tmp.
  2. You’ve got a proj_master and proj_mod.
  3. You clone porj_master as proj_ALL then clone prom_mod as a submodule in it.
  4. You rename proj_ALL to proj_onebillion. Then black magic happens.

The following steps will reproduce the problem I mentioned. The version of git I use is:

$ git --version
git version 1.7.9.5

  1. Initialize proj_master.

    $ cd /tmp
    $ mkdir proj_master; cd proj_master
    $ git init .
    $ touch README
    $ git add .; git commit -m "hello proj_master"
    
  2. Initialize proj_mod.

    $ cd /tmp
    $ mkdir proj_mod; cd proj_mod
    $ git init .
    $ touch README
    $ git add .; git commit -m "hello proj_mod"
    
  3. Clone proj_master as proj_ALL and clone proj_mod as a submodule.

    $ cd /tmp
    $ git clone proj_master proj_ALL
    $ cd proj_ALL
    $ git submodule add /tmp/proj_mod ./mod
    $ git add .; git commit -m "hello proj_ALL"
    $ git status   % Everything is OK.
    
  4. Rename proj_ALL to proj_onebillion. Encounter a fatal error.

    $ cd /tmp
    $ mv proj_ALL proj_onebillion
    $ cd proj_onebillion
    $ git status
    fatal: Not a git repository: /tmp/proj_ALL/.git/modules/mod
    

One thing to notice is the .git file in the submodule directory.

$ cat /tmp/proj_ALL/mod/.git 
gitdir: /tmp/proj_ALL/.git/modules/mod

Yeah, an absolute path. For the first time, I realize that git is aware of something outside the scope of the top-level repo folder.

That’s it. I repeat that one more time that I rename the top-level project folder, not the submodule folder. I check schmuck’s question, which tried to rename the submodule folder, therefore seems not so helpful to my problem.

If I miss something that should have been read before, I apologize. To all guys, any advice is welcomed.

  • 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-06-04T05:03:38+00:00Added an answer on June 4, 2026 at 5:03 am

    You have a couple of options, they end up being the same thing:

    clone again

    Instead of renaming the folder – just clone again

    $ cd /project/original
    $ cd ..
    $ mkdir moved
    $ git init
    $ git pull ../original master
    $ git submodule init
    $ git submodule update
    

    Compare original/.git/config to moved/.git/config and address any significant differences (missing branches need creating – missing remotes just need adding to the config file).

    fix paths

    You can rename your project folder, it just needs a little tweaking.

    • Fix your submodule .git file references.

    I.e. these files:

    $ cd /project/moved
    $ find -name .git -type f
    

    All you need to do is edit them to point at the right directory

    • Fix your submodule .git config files

    I.e. these files:

    $ cd /project/moved
    $ find .git/modules/ -name config
    

    Here, update the worktree setting:

    [core]
        ...
        worktree = /original/path/submodule
    

    To

    [core]
        ...
        worktree = /moved/path/submodule
    

    And that’s it.

    A note about versions

    1.7.8 introduced the use of a .git file for submodules and used absolute paths, this was fixed in 1.7.10 – therefore the problem only applies to git repos created with git version 1.7.8, and 1.7.9.

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

Sidebar

Related Questions

i have this problem which i never expect it to occur. When i pressed
In Javascript The Good Parts , it states: So I would expect the following
A project I'm working on supposed to authenticate users agains AD. I've never worked
I've just come across a strange behaviour in Oracle where I would expect ORA-00918
I would expect that after I push a view controller I then need to
I would expect the following code to display 'hi mom' between the <div id='job-status'></div>
SRP ( PDF version; HTML version) states that There should never be more than
I guess it's socket programming. But I have never done socket programming expect for
I have a very simple Makefile that isn't doing what I expect it would
Never thought I'd have this problem :) The following snippet of code works in

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.