Skip to content
Proyectos

Acerca de

Your work is real. Your contribution graph should show it.

Herramientas de desarrollo

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
+1

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

greens

Your work is real. Your contribution graph should show it.

If you commit to private/org repos all day but your GitHub profile looks empty, greens fixes that. It mirrors commit timestamps (and optionally PRs, reviews, issues) to a GitHub repository without exposing any code. The mirror is private by default.

greens demo

Windows 10/11 support is in beta. If you try it on a real machine, please share results in Discussions for reports and Issues for bugs.

Install

macOS

brew install yuvrajangadsingh/greens/greens

After upgrading from v1.8.2, run greens --setup once to repair scheduled jobs. See the upgrade notes for details.

Windows (10/11)

Requires Git for Windows (includes Git Bash).

git clone https://github.com/yuvrajangadsingh/greens.git
cd greens
greens.cmd

The setup wizard runs on first use and offers Windows Task Scheduler for daily automation.

Note: Unlike launchd on macOS, Windows Task Scheduler does not catch up on missed runs. If your machine was off or sleeping at the scheduled time, the sync is skipped until the next day. Logs are written to ~/.contrib-mirror/logs/sync.log.

WSL users: Use the macOS/Linux instructions inside WSL. Don't run both WSL and Windows setups, they'll create duplicate commits.

SSH keys: If your SSH key has a passphrase, the scheduled task may fail silently. Use a passphrase-less key or configure ssh-agent to start at Windows login.

Linux

Install Bash, Git, the GitHub CLI, and jq. GitLab activity additionally requires glab. Authenticate each service before setup:

gh auth login
glab auth login --hostname gitlab.example.com
git clone https://github.com/yuvrajangadsingh/greens.git
cd greens
bash install.sh --local

The local installer links this checkout into ~/.local/bin; keep the checkout in place and add that directory to PATH. Setup detects and groups source providers automatically. Linux offers a systemd user timer, cron, or manual sync. The timer catches up after login when the machine missed its scheduled run; failed runs retry every 15 minutes. It runs as your user without sudo.

See GitLab setup and activity semantics for configuration, authentication, scheduling, and troubleshooting.

Manual install (macOS/Linux)
git clone https://github.com/yuvrajangadsingh/greens.git
cd greens
bash install.sh --local

This links the checkout into ~/.local/bin and starts setup. Keep the checkout in place and add ~/.local/bin to PATH. On Windows, use the steps above.

Then just run greens (macOS/Linux) or greens.cmd (Windows). Setup wizard runs on first use.

What it does

  1. Scans your work repos (never modifies them)
  2. Extracts commit timestamps for your email(s) across all branches
  3. Detects GitHub, GitHub Enterprise, GitLab, and generic Git sources per organization
  4. Optionally fetches provider-specific collaboration activity for each configured source
  5. Creates empty commits with matching timestamps in a mirror repo, authored with a generic name and your personal email
  6. On a verified-private mirror, writes a dashboard README showing which repos your activity came from (visible only to people with access to that private repo)
  7. Pushes to your mirror repo (private by default)

No source code, file paths, branch names, or messages ever leave your machine (messages only if you explicitly opt in to copying commit subjects). Work repo names appear in exactly one place — the dashboard README — and that is only written while the mirror is positively verified private via the GitHub CLI. Public or unverifiable mirrors get empty commits and nothing else.

Works with any git remote. Your source repos can be on GitHub, GitLab, Bitbucket, or self-hosted. greens finds them through your local clones and fetches history from each clone's remote. A local-only source reads its clones (commits only) and never fetches from that source's remote. The mirror destination is GitHub (GitLab/Bitbucket mirror support is planned).

Usage

greens                    # sync (runs setup on first use)
greens sync               # same as above
greens init --in-root     # setup using immediate child repositories only
greens --setup --remove-work-dir ~/old-work  # remove a saved repository root
greens --status           # show config and sync status
greens --setup            # reconfigure; retain saved mode (recursive initially)
greens --setup --recursive  # explicitly restore recursive scanning
greens --resync           # wipe and re-sync (pre-1.9 GitHub configs only)
greens --privacy-migrate  # rewrite mirror history (upgrade from <= 1.8.1)
greens --reset            # remove everything

Example output

On a verified-private mirror, the dashboard README shows where your activity came from (only people with access to your private mirror can see this):

Total Commits: 888 | Active Days: 158 | Repos Tracked: 11

backend-api     325  ███████░░░░░░░░░░░░░  36%
auth-service    270  ██████░░░░░░░░░░░░░░  30%
data-pipeline   246  █████░░░░░░░░░░░░░░░  27%

On a public (or unverifiable) mirror, this table is never written — the mirror stays empty commits only.

The privacy rules (v1.8.2)

  • Mirrors are created private by default; making one public requires typing PUBLIC in the wizard.
  • The dashboard README (work repo names) is written only while the mirror is positively verified private via the GitHub CLI. One gh check per sync.
  • If a mirror carrying dashboard history is public — or its visibility can't be verified (gh missing/logged out, non-GitHub remote) — greens sync refuses with exit code 3 and tells you how to fix it. There is no bypass. Make it private (and gh auth login), or scrub the history.
  • The dashboard's status commits are authored as greens-status <[email protected]>, a neutral non-account identity, so they never paint a contribution square.

Scrubbing history: --privacy-migrate

Optional tooling, useful when your mirror was ever public with the dashboard in it (any greens version up to 1.8.1 wrote the dashboard unconditionally), or when you just want a mirror with nothing but empty commits.

greens --privacy-migrate

This one-shot command (asks for a typed YES):

  • requires the GitHub mirror to be private first — it verifies visibility via gh and fails closed if it can't (make the repo private, then re-run)
  • verifies every reachable commit in the mirror contains only greens-generated content; any user file, handwritten README, or unrecognized ref aborts the whole thing with nothing changed
  • writes a private local backup bundle of the old history under ~/.contrib-mirror/backups/ (0600; it contains the old sensitive history — never upload it)
  • rebuilds the history with empty-tree commits, preserving each commit's exact author and committer timestamps (epoch + timezone offset), so your contribution graph doesn't change
  • drops greens' own synthetic init / "Update sync status" commits (identified structurally, not just by message)
  • re-authors every commit as greens <your personal email> and redacts previously copied messages to sync (--keep-messages keeps raw commit subjects, needs a second typed KEEP MESSAGES ack; legacy PR/review/issue titles become generic labels either way)
  • updates the default branch and deletes every stray remote ref (old branches, tags, notes) in one atomic, lease-protected force-push, then re-checks the remote before declaring success
  • sets COPY_MESSAGES=0 and never pushes any backup ref

After a scrub, the normal rule still applies going forward: if the mirror is verified private, the next sync writes a fresh dashboard; if not, it never does.

Honest limits: the old README, identities, and messages are removed from the rewritten remote history and fresh clones — not erased everywhere. Existing clones, forks, old-SHA URLs, caches, screenshots, and your local backup bundle still hold the old content.

Tracks more than commits

This table describes the GitHub provider. The GitLab provider is described below and in the provider guide.

Activity Tracked?
Commits Yes (always)
PRs opened Yes (with gh CLI)
Issues opened Yes (with gh CLI)
PR reviews Opt-in. Each review lands on the day it was submitted. Pre-1.9 configs still use the PR's last update time, which can move to a later day

Setup saves SOURCE_N_USERNAME for each GitHub host/organization and requires a matching authenticated gh session. Legacy configurations can still use GITHUB_USERNAME.

How it works under the hood
┌─────────────────────┐     ┌─────────────────────┐     ┌─────────────────────┐
│   Your Work Repos   │     │    Safe Cache       │     │   GitHub Mirror     │
│   (never touched)   │     │   (bare clones)     │     │   (empty commits)   │
├─────────────────────┤     ├─────────────────────┤     ├─────────────────────┤
│  backend-api/       │────▶│  .cache/backend.git │     │                     │
│  auth-service/      │────▶│  .cache/auth.git    │────▶│  commit: 2024-01-15 │
│  data-pipeline/     │────▶│  .cache/data.git    │     │  commit: 2024-01-16 │
└─────────────────────┘     └─────────────────────┘     │  commit: 2024-01-17 │
                                                        └─────────────────────┘
                                      +
                            ┌─────────────────────┐
                            │   GitHub API        │
                            │   (optional)        │
                            ├─────────────────────┤
                            │  PRs opened         │
                            │  Reviews submitted  │────▶  More timestamps
                            │  Issues created     │
                            └─────────────────────┘
Configuration reference
Variable Required Default Description
WORK_DIRS Yes prompted Newline-separated directories containing work repositories
SCAN_MODE Yes recursive recursive or immediate child folders only with in-root
SOURCE_COUNT Yes detected Number of indexed host/organization source records
SOURCE_N_PROVIDER Yes detected github, gitlab, or git for source N
SOURCE_N_REMOTE_HOSTS Yes detected Comma-separated Git remote hosts and SSH aliases
SOURCE_N_API_HOST Yes detected GitHub/GitLab web and API hostname
SOURCE_N_ORGANIZATION Yes detected GitHub owner or top-level GitLab namespace
SOURCE_N_USERNAME API activity authenticated user Actor for API activity
SOURCE_N_EMAILS Commits detected Exact Git author emails; enter - during setup to omit the group
SOURCE_N_SINCE Yes current January 1 History start for this source
SOURCE_N_ACTIVITY_TYPES Yes provider default Provider-specific activity selection
SOURCE_N_ACCESS_MODE No remote remote fetch/API collection or local commit-only history
MIRROR_DIR Yes ~/.contrib-mirror/mirror Local clone of your GitHub mirror
MIRROR_EMAIL Yes - Personal GitHub email for mirror commits (sync exits with code 2 if unset)
MIRROR_NAME No greens Author name for mirror commits (keep it generic)
COPY_MESSAGES No 0 Set to 1 to copy raw git commit subjects (PR/issue/review items always get generic labels)
COPY_MESSAGES_ACK No 0 Written by setup when you type the COPY_MESSAGES confirmation; sync refuses COPY_MESSAGES=1 without it
FORCE No 0 Set to 1 to bypass daily limit (does not bypass the privacy gate)

Legacy WORK_DIR, SOURCE_PROVIDER, REMOTE_PREFIX, GITHUB_*, GITLAB_*, and global EMAILS, SINCE, and ACTIVITY_TYPES values remain supported.

Auth methods for multi-account setups

If your work GitHub account differs from your personal one:

Method Best for Setup
Personal Access Token HTTPS users, simplest Create PAT with repo scope, set GITHUB_TOKEN
Multi-account gh CLI SSH users with multiple accounts gh auth login each account; setup saves one account per source
Single account One account has source access Authenticate it with gh auth login

Works with both SSH and HTTPS repo access.

Automatic mixed-provider setup

Setup scans every configured work directory and groups repositories by provider, API host, and organization. One mirror can contain GitHub, GitHub Enterprise, GitLab, self-managed GitLab, and generic Git sources. Each group has independent actor, author emails, history start, and activity types. See the multi-provider configuration guide and the GitLab activity reference.

Known public hosts are recognized immediately. For an unfamiliar host, setup asks for its web/API domain and performs bounded, TLS-verified GitHub and GitLab checks. It asks for manual classification only when those checks are inconclusive. GitHub and GitLab aliases and duplicate clones are counted and processed once by their configured API host and repository path. Generic Git identities retain the remote endpoint, including explicit ports, so separate servers on the same host are collected independently.

Enter one work directory at a time; setup keeps asking for another until you press Enter. Every detected GitHub owner becomes its own source record, so no global organization or separate-account prompt is needed.

Use greens --setup --in-root when each work directory directly contains its repositories. This persists SCAN_MODE=in-root, so setup, status, and sync only inspect .git files or directories in immediate child folders. The root itself and deeper descendants are ignored. greens --setup --recursive restores the default recursive behavior. When explicitly switching to --in-root, setup removes saved source groups found only outside the immediate child folders. Sources whose checkouts are genuinely unavailable remain saved.

At each host/organization email prompt, enter - to skip that entire source group. This can exclude multiple repositories when they share a host and top-level organization. Skipped groups are omitted from the saved source list and will be offered again the next time setup scans those directories.

Setup verifies source Git and required provider API access. If a complete host/organization group is unavailable, you can confirm local-only mode. That mode scans all refs already present in matching checkouts, including unpushed commits, and never fetches or calls the source provider API. Provider-only activity such as pull/merge requests, reviews, issues, and comments is therefore unavailable. An interactive sync offers the same persistent fallback when a remote group becomes unreachable; scheduled runs fail with instructions instead of changing configuration without confirmation.

On a setup rerun, remove saved work directories by their displayed number or use repeatable --remove-work-dir PATH flags with greens --setup, greens init, or bash setup.sh. Setup does not replace the configuration until the remaining roots and regenerated source groups validate successfully.

For multiple GitHub accounts, authenticate each account with gh auth login. API requests and HTTPS Git operations use the account saved for each source or destination without changing the active gh account. This keeps concurrent configurations independent and allows a valid saved account to work when another account has expired. SSH mirrors retain their aliases and key selection. Setup pre-fills the personal username and verified email from gh.

SOURCE_PROVIDER is intentionally absent from new configurations: provider is part of every indexed source record, and a global value would conflict with mixed sources. It remains supported as a legacy input.

Setup saves personal defaults to ~/.contrib-mirror/config, an owner-only shell configuration file outside the checkout. Both setup and sync honor CONTRIB_MIRROR_CONFIG for an alternate location. Environment variables override saved values. No tracked .env file is needed.

FAQ

Is any code exposed?

No source code, ever. What IS in the mirror, honestly:

  • Empty commits carrying your work timestamps. Whoever can see the mirror can see your work cadence (timezone, late nights, weekends, gaps). That's why mirrors are private by default; your squares still count via GitHub's "Include private contributions" toggle.
  • On a verified-private mirror only: a dashboard README listing your work repo names with per-repo counts — visible solely to people with access to that private repo. On a public or unverifiable mirror the repo-names table is never written, and syncing on top of existing dashboard history is refused outright.
  • COPY_MESSAGES=1 (opt-in, typed confirmation) copies raw git commit subjects. Merge subjects commonly contain org and branch names. PR/review/issue activity always gets a generic label ("PR activity"), never the title.

If your mirror was ever public while it had the dashboard (all versions up to 1.8.1 wrote it unconditionally): greens --privacy-migrate scrubs it from the rewritten remote history and fresh clones.

Will this affect my private repos?

No. The script creates bare caches and never modifies your working directories.

Does it check all branches or just main?

All branches. Scans across every branch using git log --all. Commits aren't double-counted after merge. For squash merges, old branch commits are pruned once the remote branch is deleted.

Can the mirror repo be private?

It's private by default (since v1.8.2). Enable "Include private contributions on my profile" in GitHub Settings > Profile so the green squares show to visitors. A public mirror is possible but the setup wizard makes you type PUBLIC to confirm, because even empty commits expose your exact work timing to anyone.

Can I backfill old contributions?

Yes. Rerun setup, change SOURCE_N_SINCE for the relevant organization, then run FORCE=1 greens.

How do I start over with a clean mirror?

Pre-1.9 GitHub configs can run greens --resync. If the mirror still has the old dashboard README, run greens --privacy-migrate first.

Current configs never rewrite mirror history. To start over:

  1. If the wrong commits came from source history that was rewritten since, move the activity-state folder out of greens' cache directory first (~/.contrib-mirror/cache, or your CACHE_DIR if you set one), or greens replays them from its cache. Changing emails, start date, activity types or access mode already starts a fresh cache.
  2. Run greens --setup, fix the source settings, and enter a new mirror repo URL (setup offers to create it) and an unused local mirror directory.
  3. Delete the old mirror repo on GitHub. While it exists, its commits keep counting on your graph.
Troubleshooting
Problem Solution
"No matching repos found" Run setup and check WORK_DIRS, remote aliases, and source organizations
"clone failed" Check SSH access: ssh -T [email protected]
"gh CLI not authenticated" Run gh auth login --hostname HOST for every configured GitHub host
"glab actor mismatch" Run glab auth login --hostname HOST with the configured GitLab actor
Empty contribution graph Wait 24h for GitHub to update and check the mirror has commits. For a private mirror, turn on Private contributions (your profile page, Contribution settings above the calendar). Commits count only if MIRROR_EMAIL is an email on your GitHub account or its noreply address
Wrong timestamps Check SOURCE_N_EMAILS (or legacy EMAILS) against commit author emails
Mirror has wrong commits See "How do I start over with a clean mirror?" above
"not verified PRIVATE" refusal (exit 3) Make the mirror private + gh auth login, or scrub with greens --privacy-migrate
Dashboard README missing The mirror isn't verified private — check gh auth status and the repo's visibility
"MIRROR_EMAIL is not set" (exit 2) Run greens --setup and set your personal GitHub email
"Already synced today" Use FORCE=1 greens to override daily limit

License

MIT

Explorar proyectos relacionados

Cargando…