Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Nahum Maciel
Nahum Maciel
3,801 Points

[Question]Choosing Location When Creating New Repository

Hi, I am using Git Bash on Windows 10 and I noticed that when you create a new repository Git determines a location on a drive I don't want my files to be saved on. Is there a way to choose the driver and folder when creating a new repository, instead of creating the repository then using mv to move the file?

3 Answers

Chris Wiley
Chris Wiley
14,669 Points

If you are creating a repository you need to be in the project folder and use:

git init

This will created the repo in that folder.

If you are cloning a repo it will create a folder in the current dir you are in.

Nahum Maciel
Nahum Maciel
3,801 Points

Ok, but how do you map a different folder in a separate drive. This way I make sure I am saving the Repo in the drive and folder I want.

Chris Wiley
Chris Wiley
14,669 Points

All you have to do is navigate to the directory you want to put you project in

So if you are in C:\ and want to put your files on another drive just go to that drive Say D: Create the project folder Then create the repo

C:\ D:
D:\mkdir project folder

D:\cd project folder

D:\project folder\git init

This will create a repo in the drive and folder you want. Same with cloning a repo. Just navigate to the drive and folder you want the project to reside in.

Nahum Maciel
Nahum Maciel
3,801 Points

Awedome Chris. Thank you.