# Default Clone Dir?

3 messages from 2019-08-04 to 2019-08-04. Participants: johnywhy@gmail.com, brian m. carlson.
Thread: https://gitlist.dev/t/51586

## johnywhy@gmail.com, 2019-08-04 17:13

Subject: Default Clone Dir?
Message-ID: <1564938816.2622.1@gmail.com>
URL: https://gitlist.dev/e/1564938816.2622.1%40gmail.com

```
hi,
Is there a way to set default clone destination directory on linux?
Currently, seems to clone to the active dir.
-thx!



```

## brian m. carlson, 2019-08-04 17:20

Subject: Re: Default Clone Dir?
Message-ID: <20190804172008.GG118825@genre.crustytoothpaste.net>
URL: https://gitlist.dev/e/20190804172008.GG118825%40genre.crustytoothpaste.net
In-Reply-To: <1564938816.2622.1@gmail.com>

```
On 2019-08-04 at 17:13:36, johnywhy@gmail.com wrote:
> hi,
> Is there a way to set default clone destination directory on linux?
> Currently, seems to clone to the active dir.

It sounds like you want to always clone repositories to a single
directory. git clone doesn't have a configuration setting to do that,
but you can specify the directory you want to clone. For example:

  git clone https://github.com/git/git.git

would create a directory "git" under the current directory, but you
could also write the following:

  git clone https://github.com/git/git.git ~/checkouts/git

to create the repository in ~/checkouts/git. You can also do this:

  git -C ~/checkouts clone https://github.com/git/git.git

which will change to ~/checkouts and then perform the clone there. "-C"
says to change directory to the given location before running the
command; it must be specified before the "clone" command.

If you want to automate this, you can create an alias:

  git config --global alias.myclone '!f () { git -C ~/checkouts clone "$@"; };f'
  git myclone https://github.com/git/git.git

and then your alias will always clone to that directory.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

```

## johnywhy@gmail.com, 2019-08-04 18:29

Subject: Re: Default Clone Dir?
Message-ID: <1564943361.2622.2@gmail.com>
URL: https://gitlist.dev/e/1564943361.2622.2%40gmail.com
In-Reply-To: <20190804172008.GG118825@genre.crustytoothpaste.net>

```
Thx! The alias is super.




```
