git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Default Clone Dir?
@ 2019-08-04 17:13 johnywhy
  2019-08-04 17:20 ` brian m. carlson
  0 siblings, 1 reply; 3+ messages in thread
From: johnywhy @ 2019-08-04 17:13 UTC (permalink / raw)
  To: git

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Default Clone Dir?
  2019-08-04 17:13 Default Clone Dir? johnywhy
@ 2019-08-04 17:20 ` brian m. carlson
  2019-08-04 18:29   ` johnywhy
  0 siblings, 1 reply; 3+ messages in thread
From: brian m. carlson @ 2019-08-04 17:20 UTC (permalink / raw)
  To: johnywhy; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Default Clone Dir?
  2019-08-04 17:20 ` brian m. carlson
@ 2019-08-04 18:29   ` johnywhy
  0 siblings, 0 replies; 3+ messages in thread
From: johnywhy @ 2019-08-04 18:29 UTC (permalink / raw)
  To: brian m. carlson; +Cc: git

Thx! The alias is super.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-04 17:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-04 17:13 Default Clone Dir? johnywhy
2019-08-04 17:20 ` brian m. carlson
2019-08-04 18:29   ` johnywhy

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).