ghq icon indicating copy to clipboard operation
ghq copied to clipboard

how does one specify which root to clone under?

Open molleweide opened this issue 3 years ago • 4 comments

Hi there,

(First of all, many thanks for creating this project!!)

If I want to manage all of my neovim plugins under, eg. ~/code/plugins/nvim, how can I achieve this with ghq. I have now read through the README a couple of times and I would like to ask for some help on this.

// Cheers.

molleweide avatar Jan 10 '22 11:01 molleweide

I found that there already exists a relevant issue at https://github.com/x-motemen/ghq/issues/200. If I get a response or my problem is resolved I will come back and close.

molleweide avatar Jan 11 '22 18:01 molleweide

You can control this by setting the environment variable GHQ_ROOT (which takes precedence over anything else)

~ % cd /tmp
/tmp % ghq get teoljungberg/dotfiles
    exists /Users/teo/src/github.com/teoljungberg/dotfiles
/tmp % GHQ_ROOT=$(pwd) ghq get teoljungberg/dotfiles
     clone https://github.com/teoljungberg/dotfiles -> /tmp/github.com/teoljungberg/dotfiles
       git clone --recursive https://github.com/teoljungberg/dotfiles /tmp/github.com/teoljungberg/dotfiles
Cloning into '/tmp/github.com/teoljungberg/dotfiles'...
remote: Enumerating objects: 12424, done.
remote: Counting objects: 100% (1520/1520), done.
remote: Compressing objects: 100% (836/836), done.
remote: Total 12424 (delta 915), reused 1221 (delta 630), pack-reused 10904
Receiving objects: 100% (12424/12424), 2.72 MiB | 2.44 MiB/s, done.
Resolving deltas: 100% (7517/7517), done.

teoljungberg avatar Feb 02 '22 15:02 teoljungberg

Hi man, thanks for replying. I was refering to using multiple roots, which is discouraged..

molleweide avatar Feb 03 '22 06:02 molleweide

Interesting, perhaps you can set environment variable GHQ_ROOT based on directory with DirEnv or set a different environment setting in .gitconfig per directory/source pattern. I doubt either will work out of the box, but try it out!

See also #300 which seems to be a duplicate.

mlavi avatar Oct 18 '22 21:10 mlavi