-
Notifications
You must be signed in to change notification settings - Fork 2
Document private Git repository authentication for Registry Server #513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b383f4f
9b5a5c2
b89fcf9
47700d1
826afc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,6 +102,7 @@ registries: | |
| - `tag` (optional): Tag name to pin to a specific version | ||
| - `commit` (optional): Commit SHA to pin to a specific commit | ||
| - `path` (required): Path to the registry file within the repository | ||
| - `auth` (optional): Authentication for private repositories (see below) | ||
|
|
||
| :::tip | ||
|
|
||
|
|
@@ -111,6 +112,103 @@ precedence over `branch`. | |
|
|
||
| ::: | ||
|
|
||
| #### Private repository authentication | ||
|
|
||
| To access private Git repositories, configure the `auth` section with your | ||
| credentials: | ||
|
|
||
| ```yaml title="config-git-private.yaml" | ||
| registries: | ||
| - name: private-registry | ||
| format: toolhive | ||
| git: | ||
| repository: https://github.com/my-org/private-registry.git | ||
| branch: main | ||
| path: registry.json | ||
| # highlight-start | ||
| auth: | ||
| username: oauth2 | ||
| passwordFile: /secrets/git/token | ||
| # highlight-end | ||
| syncPolicy: | ||
| interval: '30m' | ||
| ``` | ||
|
|
||
| **Authentication options:** | ||
|
|
||
| - `auth.username` (required with `passwordFile`): Git username for HTTP Basic | ||
| authentication. For GitHub and GitLab, use `oauth2` as the username when | ||
| authenticating with a personal access token (PAT). | ||
| - `auth.passwordFile` (required with `username`): Absolute path to a file | ||
| containing the Git password or token. Whitespace is trimmed from the file | ||
| content. | ||
|
|
||
| :::warning | ||
|
|
||
| Both `username` and `passwordFile` must be specified together. If only one is | ||
| provided, the configuration will fail validation. | ||
|
|
||
| ::: | ||
|
|
||
| **Using with Kubernetes secrets:** | ||
|
|
||
| In Kubernetes deployments, mount a secret containing your Git token and | ||
| reference the mount path: | ||
|
|
||
| :::note | ||
|
|
||
| This is not the full `Deployment` manifest and has been shortened to display the | ||
| git credentials configuration | ||
|
|
||
| ::: | ||
|
|
||
| ```yaml title="registry-deployment.yaml" | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: git-credentials | ||
| type: Opaque | ||
| stringData: | ||
| token: ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: registry-server | ||
| spec: | ||
| ... | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: registry | ||
| volumeMounts: | ||
| - name: git-credentials | ||
| mountPath: /secrets/git | ||
| readOnly: true | ||
| - name: data | ||
| mountPath: /data | ||
| readOnly: false | ||
|
Comment on lines
+188
to
+190
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Side note for future improvement: the /data path is used a bunch of times in this doc, but never actually explained.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added a note for this 👍 give it a look and let me know what you think
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, it feels kind of random there (also the grammar is off - "in order to storage"). But looking at it again, I guess this IS the first time mounting a volume as /data is done. This begs the question, why isn't it introduced above in the main "Git repository source" section? Then, having it appear again in the authenticated example would make sense without an extra note. Is it required (must not be since I don't have it in my config)? If not, why/when use it? |
||
| volumes: | ||
| - name: git-credentials | ||
| secret: | ||
| secretName: git-credentials | ||
| items: | ||
| - key: token | ||
| path: token | ||
| - name: data | ||
| emptyDir: {} | ||
| ``` | ||
|
|
||
| :::note | ||
|
|
||
| The `/data` mount path is used by the registry server in order to storage cloned | ||
| Git repositories. | ||
|
|
||
| ::: | ||
|
|
||
| Then reference `/secrets/git/token` as the `passwordFile` in your registry | ||
| configuration. | ||
|
|
||
| ### API endpoint source | ||
|
|
||
| Sync from upstream MCP Registry APIs. Supports federation and aggregation | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.