Clone Github repo to specific Windows folder?
Asked Answered
D

6

13

How to change the cloning folder of a specific git? My default storage directory is here

C:\Users\myPC\Documents\GitHub

But for this one git

https://github.com/username/myproject

I want to put it in

C:\somefolder

(and not like C:\somefolder\myproject but all the files under C:\somefolder)

How to do that? I tried git clone command line but then the git doesn't show up in my Github for Windows client

Sorry for basic question but couldn't google or search here any answer!

Discommodity answered 20/12, 2012 at 7:40 Comment(1)
UPDATE: current Github Desktop / File / Clone repository has "Local path" field, which can be altered as desired. (Verified on both Windows and Mac). See this answer: https://mcmap.net/q/881218/-clone-github-repo-to-specific-windows-folderSporocyst
S
5

After you have manually cloned the repository with git clone, you can manually Add a local repository to Github for Windows (I can't take a screenshot right now because I'm on another machine, but it should be relatively easy to find). I honestly don't know, though, if this will then have the full set of features (i.e. if GhfW recognizes it as a Github clone), or if it will have the reduced "regular" set for repositories in general.

As always: Try it and see! :D

Soggy answered 20/12, 2012 at 7:42 Comment(1)
Basically I had to "drag" the folder into the Github for WindowsDiscommodity
I
1

In "GitHub for Windows" first go to Tools-->Options Here select your folder in "default storage directory". Now in GitHub if you click on "Clone in Desktop" button then it will clone in selected folder

Ingenerate answered 7/4, 2014 at 12:45 Comment(2)
Thanks, this worked perfectly for me using the latest, recently downloaded GitHub for Windows. The field to change is in the top right and called "Clone Path", and after changes, click Update in the bottom left to save.Apulia
Which doesn't really answer the question, which is: How to clone this one repo into some other folder. Without touching the default location.Urethroscope
C
1

Another option that I've tried is to use the "Create repo" command to create an (empty) repository in the folder of your choice, and then hook it up to Github by:

  1. Opening the repository settings (click the cog on the top right, select "Repository settings...")
  2. Copying and pasting the HTTPS clone URL from the Github page (in the right sidebar) into the field that says "Primary remote (origin)"
  3. Sync the repo with the newly attached origin. You may need to open it in shell to get it to work without errors.

Why Github doesn't make this easier, I do not know. Two years after this question was posted, and it's still a hassle. It's nice to have a default storage directory, but it's also nice to have a "Where do you want to save this?" option.

Finally, if you do clone a repo into the wrong place, and want to move it somewhere else:

  1. Open up the repo in Explorer (if you're not sure where it is on your local file system, use the "Open in Explorer" option from the little cog icon on Github for Windows).
  2. Cut and paste the entire folder to wherever you want it to be.
  3. Go back to Github for Windows. It will now give you an error message that it cannot locate the repository. Select the "Locate" option, and find the folder's new location yourself.

This might actually be the easiest option for getting the repo where you want it.

Caboose answered 5/1, 2015 at 3:46 Comment(0)
S
1

The latest GitHub desktop client (3.3.4.0) prompts for a local directory to clone the repo to. This was when cloning my own repo from github.com to local.

Sterner answered 29/9, 2017 at 9:13 Comment(0)
U
0

I've downloaded recently GitHub for Windows and it didn't come with option Add a local repository.

I had to clone and delete the folder in Windows Explorer.
The program gives and error for this repository and the option to locate the new folder or remove.
Locate the folder to which one that you want.

Unveil answered 20/6, 2014 at 1:37 Comment(1)
I stopped using Github for Windows. It isn't worth the trouble. Check out SmartGit/Hg which is 10x better...Discommodity
N
0

Just change the working directory in git bash by the cd command. Once that is done you can check if the directory you want to download/clone your git repo pwdcommand. Now you can clone the repo into the desired folder. As usual use git clone to clone the Repository.

Hope this helps.

Nunes answered 21/11, 2016 at 15:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.