Some checks failed
CI / Test (Go 1.24.x, ubuntu-latest) (push) Successful in 1m53s
CI / Code Quality (push) Failing after 26s
CI / Security Scan (push) Failing after 11s
CI / Test Coverage (push) Successful in 1m13s
CI / Benchmarks (push) Failing after 10m22s
CI / Build CLI (push) Failing after 8s
Benchmarks / Run Benchmarks (push) Failing after 10m13s
Release / Test (push) Successful in 55s
Release / Build (amd64, darwin, ) (push) Failing after 12s
Release / Build (amd64, linux, ) (push) Failing after 6s
Release / Build (amd64, windows, .exe) (push) Failing after 12s
Release / Build (arm64, darwin, ) (push) Failing after 12s
Release / Build (arm64, linux, ) (push) Failing after 12s
Release / Release (push) Has been skipped
CI / Test (Go 1.24.x, macos-latest) (push) Has been cancelled
CI / Test (Go 1.24.x, windows-latest) (push) Has been cancelled
Move hosting from GitHub to private Gitea instance.
76 lines
2.1 KiB
Markdown
76 lines
2.1 KiB
Markdown
# Making This Go Repository Private
|
|
|
|
Notes on what changes when converting this public GitHub repo to private.
|
|
|
|
## CI/CD - No Changes Required
|
|
|
|
GitHub Actions workflows continue to work because:
|
|
- `actions/checkout@v4` uses the built-in `GITHUB_TOKEN` which has access to its own repo
|
|
- No external private dependencies are required
|
|
|
|
## Local Development
|
|
|
|
### Configure Go for Private Repos
|
|
|
|
Tell Go to bypass the public module proxy:
|
|
|
|
```bash
|
|
go env -w GOPRIVATE=github.com/yourusername/go-jdenticon
|
|
```
|
|
|
|
### Git Authentication
|
|
|
|
Ensure one of these is configured:
|
|
- SSH key linked to your GitHub account
|
|
- Personal Access Token (PAT) in git credential helper
|
|
- `~/.netrc` file with GitHub credentials
|
|
|
|
## Using as a Dependency in Other Projects
|
|
|
|
Any project that imports this module needs:
|
|
|
|
1. Set `GOPRIVATE`:
|
|
```bash
|
|
go env -w GOPRIVATE=github.com/yourusername/go-jdenticon
|
|
```
|
|
|
|
2. Configure git authentication (see above)
|
|
|
|
3. For CI in other repos, add to workflow:
|
|
```yaml
|
|
- name: Configure git for private modules
|
|
run: git config --global url."https://${{ secrets.GH_PAT }}@github.com/".insteadOf "https://github.com/"
|
|
```
|
|
(Requires a `GH_PAT` secret with `repo` scope)
|
|
|
|
## What Breaks
|
|
|
|
| Feature | Status | Notes |
|
|
|---------|--------|-------|
|
|
| pkg.go.dev documentation | Unavailable | Public proxy can't access private repos |
|
|
| "Go Reference" badges | Broken | Remove from README or accept 404 |
|
|
| Codecov | May need token | Add `CODECOV_TOKEN` secret if uploads fail |
|
|
| Anonymous `go get` | Blocked | Users need authentication |
|
|
|
|
## Codecov Fix (If Needed)
|
|
|
|
If coverage uploads fail after going private:
|
|
|
|
1. Get token from codecov.io for the repo
|
|
2. Add as repository secret: `CODECOV_TOKEN`
|
|
3. Update `.github/workflows/ci.yml`:
|
|
```yaml
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
file: ./coverage.txt
|
|
token: ${{ secrets.CODECOV_TOKEN }} # Add this line
|
|
flags: unittests
|
|
name: codecov-umbrella
|
|
fail_ci_if_error: false
|
|
```
|
|
|
|
## Reverting to Public
|
|
|
|
Simply change the repository visibility back to public in GitHub settings. No code changes required.
|