{"id":28535195,"url":"https://github.com/gerritcodereview/gcompute-tools","last_synced_at":"2025-08-19T22:14:29.594Z","repository":{"id":62065876,"uuid":"47751749","full_name":"GerritCodeReview/gcompute-tools","owner":"GerritCodeReview","description":"Tools for Google Compute Engine - (mirror of http://gerrit.googlesource.com/gcompute-tools)","archived":false,"fork":false,"pushed_at":"2025-05-17T19:02:51.000Z","size":172,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-25T01:38:32.593Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GerritCodeReview.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":"2015-12-10T09:32:43.000Z","updated_at":"2024-10-17T18:11:28.000Z","dependencies_parsed_at":"2024-10-19T18:33:21.125Z","dependency_job_id":"36843d80-d1d1-4bdc-8406-c7f0b879915a","html_url":"https://github.com/GerritCodeReview/gcompute-tools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GerritCodeReview/gcompute-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fgcompute-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fgcompute-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fgcompute-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fgcompute-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GerritCodeReview","download_url":"https://codeload.github.com/GerritCodeReview/gcompute-tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fgcompute-tools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271231130,"owners_count":24723059,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-06-09T17:14:21.107Z","updated_at":"2025-08-19T22:14:29.588Z","avatar_url":"https://github.com/GerritCodeReview.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git authentication tools for Google Compute Engine\n\nThe `git-cookie-authdaemon` uses the GCE metadata server to acquire an\nOAuth2 access token and configures `git` to always present this OAuth2\ntoken when connecting to googlesource.com or\n[Google Cloud Source Repositories][CSR].\n\n[CSR]: https://cloud.google.com/source-repositories/\n\n## Setup\n\nLaunch the GCE VMs with the gerritcodereview scope requested, for example:\n\n```\ngcloud compute instances create \\\n  --scopes https://www.googleapis.com/auth/gerritcodereview \\\n  ...\n```\n\nTo add a scope to an existing GCE instance see this\n[gcloud beta feature](https://cloud.google.com/sdk/gcloud/reference/beta/compute/instances/set-scopes).\n\n## Installation on Linux\n\nInstall the daemon within the VM image and start it running:\n\n```\nsudo apt-get install git\ngit clone https://gerrit.googlesource.com/gcompute-tools/\n./gcompute-tools/git-cookie-authdaemon\n```\n\nThe daemon launches itself into the background and continues\nto keep the OAuth2 access token fresh.\n\n### Launch at Linux boot\n\ngit-cookie-authdaemon can be started as a systemd service at boot.\n\n```\n# Write the service config\n$ sudo cat \u003e /etc/systemd/system/git-cookie-authdaemon.service \u003c\u003c EOF\n[Unit]\nDescription=git-cookie-authdaemon required to access git-on-borg from GCE\n\nWants=network.target\nAfter=syslog.target network-online.target\n\n[Service]\nUser=builder  # update to your user\nGroup=builder  # update to your group\nType=simple\nExecStart=/path/to/git-cookie-authdaemon  # update the path\nRestart=on-failure\nRestartSec=10\nKillMode=process\n\n[Install]\nWantedBy=multi-user.target\nEOF\n\n# Reload the service configs\n$ sudo systemctl daemon-reload\n\n# Enable the service\n$ sudo systemctl enable git-cookie-authdaemon\n\n# Start the service\nsudo systemctl start git-cookie-authdaemon\n\n# Check the status of the service\nsystemctl status git-cookie-authdaemon\nps -ef | grep git-cookie-authdaemon\n\n# Reboot and check status again.\n\n```\n\n## Installation on Windows\n\n### Prerequisite\n\nInstall [Python 3.9](https://www.python.org/downloads/windows/) and\n   [Git](https://git-scm.com/download) for Windows. Older Python3 versions\n will probably work but are not tested in the setup below.\n\n### Run interactively or in a build script\n\nRun `git-cookie-authdaemon` in the same environment under the same user\ngit commands will be run, for example in either `Command Prompt`\nor `Cygwin bash shell` under user `builder`. In Windows `Command Prompt`\n`start` can be used to put the process into background.\n```\npython git-cookie-authdaemon --nofork\n```\n\n### Launch at Windows boot\n\nIt may be desired in automation to launch `git-cookie-authdaemon` at\nWindows boot. It can be done as a scheduled task. The following is an\nexample on a Jenkins node:\n\n1. The VM is created from GCE Windows Server 2019 or 2012R2 image.\n1. It runs under `builder` account.\n1. It is launched from a Bash shell. Cygwin is used here. Msys2 or Git\n   Bash may work too but not tested.\n1. C:\\build exists (log file destination in wrapper script used below\n   - adjust as needed)\n\nHow to create a scheduled task.\n\n1. Launch `Task Scheduler` from an Administrator account.\n1. Click `Create Task` in the right pane.\n1. In `General` tab:\n   1. Change user to the one running Jenkins node if it is different. You may\n      want to run Jenkins node as a non-privileged user, `builder` in this\n      example.\n   1. Select `Run whether user is logged on or not`\n1. In `Trigger` tab. Add a trigger\n   1. Set `Begin the task` as `At startup`.\n   1. Uncheck `Stop task if it runs longer than`.\n   1. Check `Enabled`.\n1. In `Actions` tab.  Add `Start a program`.\n   1. Set `Program/script` as `C:\\cygwin64\\bin\\bash.ext`,\n   1. Set `Add arguments` as\n      `--login -c /home/builder/git-cookie-authdaemon_wrapper.sh` (see note\n      below)\n1. Click `Ok` to save it.\n1. Optional: click `Enable All Tasks History` in `Task Scheduler`'s right pane.\n1. Add `builder` account to `Administrative Tools -\u003e Local Security Policy -\u003e\n   Local Policies -\u003e User Rights Assignment -\u003e Log On As Batch Job`\n\nNote: `/home/builder/git-cookie-authdaemon_wrapper.sh` is as below:\n\n```\n#!/bin/bash\nexe=gcompute-tools/git-cookie-authdaemon\nlog=/cygdrive/c/build/git-cookie-autodaemon.log\n\n# HOMEPATH and HOMEDRIVE are not set in a task scheduled at machine boot.\nexport HOMEPATH=${HOMEPATH:-'\\Users\\builder'}\nexport HOMEDRIVE=${HOMEDRIVE:-'C:'}\n\n/cygdrive/c/Users/builder/AppData/Local/Programs/Python/Python39/python $exe --nofork \u003e\u003e $log 2\u003e\u00261 # option --debug is also available.\n```\n\nThis will write a log file to \"C:\\build\\git-cookie-autodaemon.log\"\nand a cookie to \"C:\\Users\\builder\\.git-credential-cache\\cookie\". The cookie is\nused for authentication by the user's gitconfig as shown below. The wrapper\nscript assumes Python 3.9 is installed to the default location of\n\"%LOCALAPPDATA%\\Programs\\Python\\Python39\"\n\nC:\\Users\\builder\\.gitconfig contains the following section\n\n```\n[http]\n        cookiefile = C:\\\\Users\\\\builder\\\\.git-credential-cache\\\\cookie\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgerritcodereview%2Fgcompute-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgerritcodereview%2Fgcompute-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgerritcodereview%2Fgcompute-tools/lists"}