You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
would clone to: ${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/${SCM_HOST}/${ORG}
GitHub Example:
ghorg clone --scm=github --preserve-host kubernetes would clone to ${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/github.com/kubernetes.
GitLab Example:
ghorg clone --scm=gitlab --preserve-host gitlab-org would clone to ${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/gitlab.com/gitlab-org
GitLab Self-Hosted Example:
ghorg clone --scm=gitlab --preserve-host --base-url=https://my.gitlab.instance.example.com/ some-gitlab-org would clone to ${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/my.gitlab.instance.example.com/some-gitlab-org
BitBucket Example:
ghorg clone --scm=gitlab --preserve-host --base-url=https://my.bitbucket.instance.example.com/ some-bitbucket-group would clone to ${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/my.bitbucket.instance.example.com/some-bitbucket-group
Describe alternatives you've considered
I currently use of the --path option to manually point my clones to ~/ghorg/{scm-hostname}/${org-name}, but this makes using ghorg reclone a little too verbose for my liking, as the reclone.yml file does not support environment variables (e.g. $HOME).
Using vmware1, 2 and saltstack3, 4 as examples, which have both GitLab.com and GitHub.com organizations, if I could set GHORG_PRESERVE_HOSTNAME in my ~/.config/ghorg/conf.yaml, I could then simplify my reclone.yaml as:
# ~/.config/ghorg/reclone.yaml# GHORG_PRESERVE_HOSTNAME: True in ~/.config/ghorg/conf.yaml## VMWare ## # clone to ~/ghorg/github.com/vmwarevmware-github:
cmd: "ghorg clone vmware --scm=github"# clone to ~/ghorg/gitlab.com/vmwarevmware-gitlab:
cmd: "ghorg clone vmware --scm-gitlab"## Saltstack ### clone to ~/ghorg/github.com/saltstacksaltstack-github:
cmd: "ghorg clone saltstack --scm=github"# clone to ~/ghorg/gitlab.com/saltstacksaltstack-gitlab:
cmd: "ghorg clone saltstack --scm=gitlab"
It currently looks like:
`~/.config/ghorg/reclone.yaml` with absolute paths
I use ghorg frequently, it's awesome!! As part of my role as a Security Operations Software Engineer, I'm constantly looking to ghorg (and frequently combine it with tools like ag) to perform software reviews, analysis and other activities. The killer feature is the ability to clone entire orgs across multiple SCM's, Cloud-Hosted or Self-Hosted.
Before ghorg, I did this all by hand with custom Python tooling that I had to build and maintain. Thanks @gabrie30!
The text was updated successfully, but these errors were encountered:
Thanks for raising this thoughtful issue @rrrix! Great to hear how you're using ghorg too!
I do see some value in this feature. However, I'm not sure when I'll have to time to get around to it.
In the meantime, what I would suggest trying is the --output-dir flag. It's not exactly what you want however it might make things a little easier on you. For example with the Debian clones you could do.
Feature Request
Please add a flag
--preserve-host
, similar to--preserve-dir
.Also, an environment variable
GHORG_PRESERVE_HOSTNAME
, similar toGHORG_PRESERVE_DIRECTORY_STRUCTURE
.This should result in the behavior described below.
Examples
Generic
Given the variables:
SCM_HOST=git.example.com SCM_URL=https://${SCM_HOST}/
The command:
would clone to:
${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/${SCM_HOST}/${ORG}
GitHub Example:
ghorg clone --scm=github --preserve-host kubernetes
would clone to${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/github.com/kubernetes
.GitLab Example:
ghorg clone --scm=gitlab --preserve-host gitlab-org
would clone to${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/gitlab.com/gitlab-org
GitLab Self-Hosted Example:
ghorg clone --scm=gitlab --preserve-host --base-url=https://my.gitlab.instance.example.com/ some-gitlab-org
would clone to${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/my.gitlab.instance.example.com/some-gitlab-org
BitBucket Example:
ghorg clone --scm=gitlab --preserve-host --base-url=https://my.bitbucket.instance.example.com/ some-bitbucket-group
would clone to${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/my.bitbucket.instance.example.com/some-bitbucket-group
Describe alternatives you've considered
I currently use of the
--path
option to manually point my clones to~/ghorg/{scm-hostname}/${org-name}
, but this makes usingghorg reclone
a little too verbose for my liking, as thereclone.yml
file does not support environment variables (e.g.$HOME
).Using
vmware
1, 2 andsaltstack
3, 4 as examples, which have both GitLab.com and GitHub.com organizations, if I could setGHORG_PRESERVE_HOSTNAME
in my~/.config/ghorg/conf.yaml
, I could then simplify myreclone.yaml
as:It currently looks like:
`~/.config/ghorg/reclone.yaml` with absolute paths
Not to mention self-hosted GitLab, BitBitbucket, and more...
Additional Context
I use
ghorg
frequently, it's awesome!! As part of my role as a Security Operations Software Engineer, I'm constantly looking toghorg
(and frequently combine it with tools likeag
) to perform software reviews, analysis and other activities. The killer feature is the ability to clone entire orgs across multiple SCM's, Cloud-Hosted or Self-Hosted.Before ghorg, I did this all by hand with custom Python tooling that I had to build and maintain. Thanks
@gabrie30
!The text was updated successfully, but these errors were encountered: