{"id":15366793,"url":"https://github.com/erkkah/git-private","last_synced_at":"2025-04-15T12:33:21.570Z","repository":{"id":57625403,"uuid":"394270098","full_name":"erkkah/git-private","owner":"erkkah","description":"Store private data inside a git repository.","archived":false,"fork":false,"pushed_at":"2023-05-18T16:59:19.000Z","size":96,"stargazers_count":24,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T20:12:09.241Z","etag":null,"topics":["age-encryption","encryption","git","git-addons","golang","secrets-management"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erkkah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-09T11:46:52.000Z","updated_at":"2025-01-03T20:20:28.000Z","dependencies_parsed_at":"2024-06-20T13:10:11.688Z","dependency_job_id":null,"html_url":"https://github.com/erkkah/git-private","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erkkah%2Fgit-private","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erkkah%2Fgit-private/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erkkah%2Fgit-private/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erkkah%2Fgit-private/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erkkah","download_url":"https://codeload.github.com/erkkah/git-private/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249072235,"owners_count":21208141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["age-encryption","encryption","git","git-addons","golang","secrets-management"],"created_at":"2024-10-01T13:19:51.346Z","updated_at":"2025-04-15T12:33:21.534Z","avatar_url":"https://github.com/erkkah.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# git-private\n\n`git-private` lets you store private data inside a `git` repo.\nA common use case is protecting files containing API keys et.c.\n\n`git-private` encrypts your private files and keeps track of a list of public keys for users that should have access to these files. The complete state (encrypted files and public keys) is kept directly in the `git` repo, there are no external dependencies.\n\nEncryption is provided by [age](https://github.com/FiloSottile/age), using either `age` or `ssh` key pairs.\n\n`git-private` is a single binary tool, for easy installation and dependency tracking.\n\n## Getting started\n\n* [Install](#Installation) `git-private`\n* In your repo, run `git private init`\n* Add the key of the first user (most likely you): `git private keys add -keyfile ~/.ssh/id_rsa -pubfile ~/.ssh/id_rsa.pub`\n* Add your private file: `git private add apikeys.json`\n* Hide (encrypt) the added file: `git private hide -keyfile ~/.ssh/id_rsa`\n\nNow, commit your changes. In this example, the changed files are:\n\n* `.gitprivate/*`\n* `.gitignore`\n* `apikeys.json.private`\n\nNote that:\n\n* the `keyfile` is used to identify **you** while the `pubfile` is the public key being added\n  * when the first key is added, the keyfile and pubfile belong to the same pair\n* the original file, `apikeys.json` is added to `.gitignore` automatically and is not commited\n* the `git-private` state lives in `.gitprivate/`\n* the `hide` command encrypts all files tracked by `git-private`\n* a user's private key should ***never*** be added to the git repo!\n\n## Private key configuration\n\nTo avoid having to specify the private key file on the command line, use one of these environment variables instead:\n\n* `GIT_PRIVATE_KEY`=\"private key data\"\n* `GIT_PRIVATE_KEYFILE`=\"path to private key file\"\n\n## Hiding files\n\nUse the `add` and `remove` commands to update the list of files that should be tracked by `git-private`.\nThen use the `hide` command to encrypt these files.\n\nHiding encrypts tracked files using the current public key list.\n\nBe default, the original files are kept in place.\nUse the `-clean` flag to remove them after encryption.\n\nExample:\n\n```shell\n$ git private hide -keyfile ~/secret.age -clean\n```\n\n## Revealing hidden files\n\nUse the `reveal` command to decrypt files.\nThis is needed after cloning a repo or when pulling changes to private files or keys.\nIf you don't want to reveal all files, you can specify a list of files to reveal.\n\n## Managing keys\n\nThe `keys` command is used to list, add, remove or generate keys.\n\nNote that except for the first key added, you need to be in the `git-private` key list to be able to access the key list.\nKeys that are added as *read-only* can only be used to reveal files, which does not require access to the key list.\n\n### `age` keys\n\n`git-private` supports `age` keys as produced by the `age-keygen` tool.\n\nSince `age` keys do not contain IDs, which is used to reference keys in `git-private`, the ID has to be provided using the `-id` flag when adding the key.\n\n`age` keys can also be generated by the `keys generate` command. The tool will prompt for a passphrase, which will be used to protect the generated private key. If no passphrase is entered, the private key will be stored in clear text, just like the `age-keygen` tool does.\n\n**Do not keep keys in the repo!**\n\n### `ssh` keys\n\nTo simplify adoption of the tool, you can use existing `ssh` keys with `git-private`.\n\n*Note that `ssh-agent` is not supported. Passphrases need to be entered on each encryption operation.*\n\n## Checking status\n\nIn general, the tool refuses to overwrite existing files without specifying the `force` flag.\nThe tool keeps a hash of the last hidden version of a file, and uses that hash to check if currently revealed files are different.\n\nUse the `status` command to check the status of files tracked by `git-private`.\n\nThe `status` command exits with code 0 (success) if all tracked files are in sync.\n\n## Installation\n\nGet pre-built binaries from [github](https://github.com/erkkah/git-private), or install using your local go toolchain:\n\n```shell\n$ go get github.com/erkkah/git-private\n```\n\n## CI/CD integration\n\nTo use `git-private` in automated build flows, create a keypair without passphrase using `git private keys generate`.\nThen add the public key to the key list with read-only access (`git private keys add -readonly`...).\n\nUse the secure variables storage feature of your CI/CD system to store the private key, and make sure `git-private` can read the key from the `GIT_PRIVATE_KEY` environment variable.\n\nNow use the `reveal -clean` command to reveal all files needed for the build and remove the `.private` files to avoid distributing them with the build.\n\n## Inspiration\n\nThis project is highly inspired by [git-secret](https://git-secret.io/), and attempts to provide the same functionality without dependencies to PGP and lots of shell stuff.\n\nhttps://latacora.micro.blog/2019/07/16/the-pgp-problem.html\n\n## Storage structure\n\nAll metadata lives in `.gitprivate`, file info in `files.json` and key info in `keys.dat`.\nEncrypted files are stored next to the original files as `original.private`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferkkah%2Fgit-private","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferkkah%2Fgit-private","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferkkah%2Fgit-private/lists"}