Re: Default Clone Dir?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2019-08-04 at 17:13:36, johnywhy@xxxxxxxxx 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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux