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