{"id":18666922,"url":"https://github.com/elsbrock/go-ghwrite","last_synced_at":"2025-07-03T13:04:06.065Z","repository":{"id":38443530,"uuid":"270945820","full_name":"elsbrock/go-ghwrite","owner":"elsbrock","description":":octocat: Commit file(s) in Github repo using the GitHub v3 API","archived":false,"fork":false,"pushed_at":"2025-04-05T14:37:53.000Z","size":88,"stargazers_count":9,"open_issues_count":5,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T15:29:39.666Z","etag":null,"topics":["cli","commit","git","github","go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elsbrock.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":"2020-06-09T08:28:59.000Z","updated_at":"2025-02-06T13:42:12.000Z","dependencies_parsed_at":"2023-02-15T16:01:32.111Z","dependency_job_id":"cd498cc5-b4e6-4d78-9073-3b2d333fb9b0","html_url":"https://github.com/elsbrock/go-ghwrite","commit_stats":{"total_commits":58,"total_committers":3,"mean_commits":"19.333333333333332","dds":0.5,"last_synced_commit":"d6cb1b7a7dbf26be3e854510cff92943b9dbba56"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsbrock%2Fgo-ghwrite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsbrock%2Fgo-ghwrite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsbrock%2Fgo-ghwrite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsbrock%2Fgo-ghwrite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elsbrock","download_url":"https://codeload.github.com/elsbrock/go-ghwrite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248495947,"owners_count":21113730,"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":["cli","commit","git","github","go"],"created_at":"2024-11-07T08:34:46.551Z","updated_at":"2025-04-11T23:33:20.466Z","avatar_url":"https://github.com/elsbrock.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-ghwrite\n\n![Build](https://github.com/elsbrock/go-ghwrite/workflows/Build/badge.svg)\n\nCommit file(s) to Github repo using the GitHub API\n\n## Synopsis\n\n```\nUsage of:\n\n  # single file\n  go-ghwrite [opts] repo/slug:targetfile \u003c sourcefile\n\n  # multiple files\n  tar cvf - file1 file2 file3 | go-ghwrite -read-tar repo/slug:\n\nParameters:\n  -branch string\n        the git branch (default \"main\")\n  -commit-msg string\n        the commit message (default \"update submitted via go-ghwrite\")\n  -email string\n        the author email, defaults to the owner email of the token\n  -name string\n        the author name, defaults to the owner name of the token\n  -read-tar                                                                                        \n        interpret input as tarball and upload individual files\n                                                                                                   \nA valid Github token with scope `repo` is required in GOGHWRITE_TOKEN.\n```\n\n## Description\n\nThis is a small CLI tool that can be used to commit one or several files to a\nGitHub repository using the GitHub API. Now typically you would of course do\nthat with `git` :-) and you are probably wondering how this can be useful:\n\nThere are certain scenarios where you do not have or want to install `git` and\nconfigured to be able to push to the repository, and instead just be able\ncommit and push with a single call. In my case I would like to commit the\nconfiguration of my router on each change but the router's default installation\ndoes not have `git` installed nor do I want to configure and maintain the key.\n\n## Usage\n\nUsage is quite simple: specify the target repository (e.g. `elsbrock/testrepo`)\nand the target file. If the target file does not exist it will be created,\nupdated otherwise. If the target file contains slashes `/` these will be\ninterpreted as directory.\n\nYou may also submit multiple files using `-read-tar`; in that case the input\nmust be an uncompressed tarball. An empty target file may be used when reading\nfrom a tarball to represent the repository root, and all files of that tarball\nwill be extracted into the root.\n\nEach successful call to the CLI will create a single commit, ie. when writing\nmultiple files at once using the tarball method a single commit will be created\nfor all of them.\n\nIf either `-name` or `-email` is given, both need to be provided. Otherwise the\nauthor information of the token owner is used.\n\n### Configuration\n\nCreate a new Personal Access Token with scope `repo` and export it into your\nenvironment under the name `GOGHWRITE_TOKEN`.\n\n\u003e Beware: this token is fairly powerful and cannot be restricted to selected\n\u003e repositories only. Make sure it is stored securely.\n\n### Limitations\n\nThe size of the files is limited by the GitHub API. Every file is read,\nbase64-encoded and submitted synchronously via single HTTP requests, so you\nshould not use this for large files.\n\n### Examples\n\n```sh\n# configure the token\nexport GOGHWRITE_TOKEN=…\n# commit and push a single file\ngo-ghwrite elsbrock/testrepo:targetfile \u003c sourcefile\n# commit and push a single file into the folder myfolder\ngo-ghwrite elsbrock/testrepo:myfolder/targetfile \u003c sourcefile\n# commit and push the contents of a tarball to the root of the repo\ntar cvf - file1 file2 file3 | go-ghwrite -read-tar elsbrock/testrepo:\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felsbrock%2Fgo-ghwrite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felsbrock%2Fgo-ghwrite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felsbrock%2Fgo-ghwrite/lists"}