Skip to content

gitconfig ghq by host isn't working #389

@cdenneen

Description

@cdenneen
[ghq]
  root = ~/.ghq

[ghq "github.com"]
  vcs = git
  root = ~/src/github.com

[ghq "gitlab.com"]
  vcs = gitlab
  root = ~/src/gitlab

[ghq "git.company.com"]
  vcs = gitlab
  root = ~/src/corp

Then

❯ ghq get [email protected]:group/path/repo                                                                                                                                                                                                                            
    exists /Users/cdenneen/.ghq/git.company.com/group/path/repo

if I understand the config properly this should have been cloned into /Users/cdenneen/src/corp/group/path/repo??

Honestly my reason for different roots is to not have to add the full "hostname" to the path but rather an alias for that hostname (shortens the directory structure).

So I would like something like:

[ghq]
  root = ~/.ghq

[ghq "github.com"]
  vcs = git
  root = ~/src/gh

[ghq "gitlab.com"]
  vcs = gitlab
  root = ~/src/gl

[ghq "git.company.com"]
  vcs = gitlab
  root = ~/src/corp

to clone this repo for example with:

ghq [email protected]:x-motemen/ghq to /Users/cdenneen/src/gh/x-motemen/ghq.

I've tried to move the [ghq] catchall to the bottom of the .gitconfig but it doesn't matter, still cloning something for that domain into the catchall root.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions