mirror of
https://github.com/gabrie30/ghorg.git
synced 2026-01-21 08:11:14 +01:00
3.1 KiB
3.1 KiB
Sourcehut Examples
Note: all command line arguments can be permanently set in your
$HOME/.config/ghorg/conf.yamlfor more information see the configuration section of the README.md.
To view all additional flags see the sample-conf.yaml or use ghorg clone --help
Things to know
- Sourcehut uses GraphQL API which requires a Personal Access Token with REPOSITORIES and OBJECTS permissions.
- For private repos, you'll need to use SSH protocol as sourcehut does not accept PATs in HTTPS URLs for authentication.
- The
--preserve-scm-hostnameflag will always create a top level folder in your GHORG_ABSOLUTE_PATH_TO_CLONE_TO with the hostname of theGHORG_SCM_BASE_URLyou are cloning from. - Username format: You can provide usernames with or without the
~prefix (e.g., bothgabrie30and~gabrie30work). Local folder paths will never include the~prefix to avoid shell expansion issues.
Examples
-
Clone a user's repos (default behavior for sourcehut)
ghorg clone <sourcehut_username> --scm=sourcehut --token=XXXXXXXOr with the
~prefix (both work):ghorg clone ~<sourcehut_username> --scm=sourcehut --token=XXXXXXX -
Clone a user's repos using SSH protocol (required for private repos)
ghorg clone <sourcehut_username> --scm=sourcehut --token=XXXXXXX --protocol=ssh -
Clone all repos from a sourcehut user that are prefixed with "go-" into a folder called "golang_projects"
ghorg clone <sourcehut_username> --scm=sourcehut --match-regex=^go- --output-dir=golang_projects --token=XXXXXXX -
Clone from a self-hosted sourcehut instance
ghorg clone <username> --scm=sourcehut --base-url=https://git.yourinstance.com --token=XXXXXXX -
Clone from a self-hosted sourcehut instance using HTTP (not recommended for production)
ghorg clone <username> --scm=sourcehut --base-url=http://git.yourinstance.com --token=XXXXXXX --insecure-sourcehut-client -
Clone and checkout a specific branch for all repos
ghorg clone <sourcehut_username> --scm=sourcehut --token=XXXXXXX --branch=develop
Sourcehut-Specific Notes
- Organizations: Sourcehut's organization concept differs from other SCM providers. Currently, ghorg treats user and org cloning identically, fetching all repos owned by the specified username.
- Private Repositories: Must use SSH protocol (
--protocol=ssh) as sourcehut doesn't support token authentication in HTTPS clone URLs. - API Limitations:
- Sourcehut's GraphQL API doesn't currently expose archived/fork status, so
--skip-archivedand--skip-forksflags won't have any effect. - The API doesn't support server-side filtering by owner, so ghorg fetches all accessible repos and filters client-side.
- Sourcehut's GraphQL API doesn't currently expose archived/fork status, so
- Topics/Tags: Topic filtering (
GHORG_TOPICS) is not currently supported as this information isn't available in the GraphQL API response.