SourceHosting - GradedJestRisk/cicd-training GitHub Wiki

Source hosting

ghorg

Work on both gitlab and github

https://github.com/gabrie30/ghorg/blob/d2a21a6d49e25222ece7f6aa2517f8501fab1e25/cmd/root.go#L287 --clone-type

  • user
  • org

https://github.com/gabrie30/ghorg

Github

https://github.com/gabrie30/ghorg/blob/master/examples/gitlab.md

Clone all repositories of an Github user

ghorg clone --token $GITHUB_PAT --clone-type=user $USER_ID

It will GET https://api.github.com/users/$USER_ID/repos?per_page=100&visibility=all

Gitlab

Clone all repositories of a group

export GROUP_NAME=
ghorg clone $GROUP_NAME --scm=gitlab --preserve-dir --path=/tmp/group --token $GITLAB_PAT --dry-run

Clone all repositories of an user

export GITLAB_USERNAME=
ghorg clone $GITLAB_USERNAME --scm=gitlab --token $GITLAB_PAT --clone-type=user 

It will GET https://gitlab.com/api/v4/groups/7618168/projects