Tools for Google Compute Engine

Clone this repo:

Branches

  1. 20d6961 Move to metadata server v1 API by Shawn Pearce · 7 months ago master
  2. 58a58ca Simple README.md for the git-cookie-authdaemon by Shawn Pearce · 7 months ago
  3. 7278586 Also configure source.developers.google.com by Shawn Pearce · 7 months ago
  4. 4e2fa66 Add a --nofork flag by Razvan Musaloiu-E · 2 years, 11 months ago
  5. ca277e1 Fix bad use of context manager in git-cookie-authdaemon. by Torne (Richard Coles) · 4 years, 4 months ago

Git authentication tools for Google Compute Engine

The git-cookie-authdaemon uses the GCE metadata server to acquire an OAuth2 access token and configures git to always present this OAuth2 token when connecting to googlesource.com or Google Cloud Source Repositories.

Setup

Launch the GCE VMs with the gerritcodereview scope requested, for example:

gcloud compute instances create \
  --scopes https://www.googleapis.com/auth/gerritcodereview \
  ...

Installation

Install the daemon within the VM image and start it running:

sudo apt-get install git
git clone https://gerrit.googlesource.com/gcompute-tools/
./gcompute-tools/git-cookie-authdaemon

The daemon launches itself into the background and continues to keep the OAuth2 access token fresh.