Clone Github repo to specific Windows folder?

前端 未结 6 2122
不知归路
不知归路 2021-02-07 16:27

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

C:\\Users\\myPC\\Documents\\GitHub

Bu

6条回答
  •  再見小時候
    2021-02-07 16:40

    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.

提交回复
热议问题