Changing the Local Path of a Repo in GitHub for Windows

GitHub for Windows has changed the way I’ve thought about Git.  As a Windows user, the console commands native to Git always seemed a bit foreign. Before GitHub for Windows, I used Git Extensions in Visual Studio 2010.  It was somewhat familiar, but still not as ‘obvious’ to use as the eventual GitHub for Windows client.

GitHub for Windows has a lot going on UI-wise.  It’s WPF based with a very modern look that sometimes hides its functionality in obscure context menus that you find by right-clicking.  That’s why I expected to find a menu option to change the local storage directory of a GitHub repo I was working with.

By default, GitHub for Windows does in fact have a configurable default storage directory.

GitHub Options
In the Tools -> Options area, the default storage directory can be set. The key word here is Default, meaning that it’s not per repo, it’s for everything.

So if I have a setting for a default storage directory, I must get a setting for each repository to change its actual storage directory if I wanted to, right?  No, you don’t.  After pondering this, and eventually figuring out the solution to this problem, I don’t really think this is a design flaw.  I think it could somehow be on purpose.  Either way, it took me quite a while to figure out how to change the local storage directory for a repo I cloned from GitHub.

Here’s how you do it.  From GitHub for Windows right-click on the name of the repository you need to move.  This will open a context menu where you need to choose ‘stop tracking this repo’.

Stop Tracking menu option

Once your local clone of the repo isn’t tracked, switch down to the github area and click on the github id of the owner of the repo you need.  In my case, it’s ‘justinsaraceno’.  Doing this will display the available repos for cloning locally.  Instead of pressing the clone icon/link on the repo, right-click on the repo name.  This will bring up a context menu where you need to choose ‘clone to…’.  Doing this will prompt you for the local file path you’d like to use.

Clone To location option

Of course this could have all been avoided if you chose the ‘clone to…’ menu option when you first cloned the repo.

8 Replies to “Changing the Local Path of a Repo in GitHub for Windows”

  1. You can move the repo’s folder to the right place using Explorer and then drag and drop the folder into GitHub window

    1. Thanks. The steps I took:

      1) Made sure everything local is checked in and synced online to master.
      2) Stopped tracking my repo in the Git Windows app.
      3) Changed the default folder location in Git Windows app
      4) Recloned my app ==> which put the code in the new local folder location where I wanted it.

    2. thanks it worked.
      My Case:
      i cloned into the wrong directory(using CLI) so github desktop can’t see the new repo. i went into explorer, cut and paste the repo’s directory into the right place. then i dragged the directory into github desktop app.

      viola github identified it and now i am working fine

  2. Alas, GitHub for Windows no longer includes the cited functionality and, therefore, this solution no longer works.

    Fortunately, after a GH support engineer told me it was not possible to rename the local folder, I figured out a very simple solution:
    1. In GHfW, synchronize all local changes
    2. Remove the repo from GHfW
    3. Rename the repo in GH (don’t panic, rename is temporary) to the exact name you want the local folder to have
    4. In GHfW, reclone the repo. Now the folder will have the desired name.
    5. Rename the repo in GH back to the original name (I told you it was temporary!)
    6. Use `git remote set-url origin` to fix the remote URL or just edit .gitconfig for the same purpose.

    Even though it’s a bit inconvenient, I was so relieved to figure out this solution. Sometimes, it’s really important for the repo name and folder name to differ!

Leave a Reply

Your email address will not be published.