Skip to content

Commit

Permalink
Add note about ghcr.io for HOMEBREW_DOCKER_REGISTRY_TOKEN
Browse files Browse the repository at this point in the history
It's not clear that when using HOMEBREW_DOCKER_REGISTRY_TOKEN directly
against ghcr.io that you should use your PAT base64-encoded as the
bearer token.
  • Loading branch information
azatoth committed Mar 2, 2024
1 parent 4e65af0 commit 1c845af
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
16 changes: 14 additions & 2 deletions Library/Homebrew/env_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,20 @@ module EnvConfig
"proxying GitHub Packages. If `HOMEBREW_DOCKER_REGISTRY_TOKEN` is set, it will be used instead.",
},
HOMEBREW_DOCKER_REGISTRY_TOKEN: {
description: "Use this bearer token for authenticating with a Docker registry proxying GitHub Packages. " \
"Preferred over `HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN`.",
description: <<~EOF,
Use this bearer token for authenticating with a Docker registry proxying GitHub Packages.
Preferred over `HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN`.
*Note:* when authenticating against ghcr.io, \
the `HOMEBREW_DOCKER_REGISTRY_TOKEN` must be a base64 \
encoded GitHub Personal Access Token (PAT).
*For example:*
```bash
export HOMEBREW_DOCKER_REGISTRY_TOKEN=$(base64<<<$(git config github.token))
```
EOF
default_text: "`QQ==` unless `HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN` is set.",
},
HOMEBREW_EDITOR: {
description: "Use this editor when editing a single formula, or several formulae in the " \
Expand Down
12 changes: 11 additions & 1 deletion docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2230,7 +2230,17 @@ command execution e.g. `$(cat file)`.
<br>Use this base64 encoded username and password for authenticating with a Docker registry proxying GitHub Packages. If `HOMEBREW_DOCKER_REGISTRY_TOKEN` is set, it will be used instead.

- `HOMEBREW_DOCKER_REGISTRY_TOKEN`
<br>Use this bearer token for authenticating with a Docker registry proxying GitHub Packages. Preferred over `HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN`.
<br>Use this bearer token for authenticating with a Docker registry proxying GitHub Packages.
Preferred over `HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN`.

*Note:* when authenticating against ghcr.io, the `HOMEBREW_DOCKER_REGISTRY_TOKEN` must be a base64 encoded GitHub Personal Access Token (PAT).

*For example:*
```bash
export HOMEBREW_DOCKER_REGISTRY_TOKEN=$(base64<<<$(git config github.token))
```

*Default:* `QQ==` unless `HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN` is set.

- `HOMEBREW_EDITOR`
<br>Use this editor when editing a single formula, or several formulae in the same directory.
Expand Down
9 changes: 9 additions & 0 deletions manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -3224,6 +3224,15 @@ Use this base64 encoded username and password for authenticating with a Docker r
.br
Use this bearer token for authenticating with a Docker registry proxying GitHub Packages\. Preferred over \fBHOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN\fR\.
.
.IP
\fINote:\fR when authenticating against ghcr\.io, the \fBHOMEBREW_DOCKER_REGISTRY_TOKEN\fR must be a base64 encoded GitHub Personal Access Token (PAT)\.
.
.IP
\fIFor example:\fR \fBbash export HOMEBREW_DOCKER_REGISTRY_TOKEN=$(base64<<<$(git config github\.token))\fR
.
.IP
\fIDefault:\fR \fBQQ==\fR unless \fBHOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN\fR is set\.
.
.TP
\fBHOMEBREW_EDITOR\fR
.
Expand Down

0 comments on commit 1c845af

Please sign in to comment.