1

My web application runs on Google App Engine (standard environment) and the purpose of it is to make automatic modifications to a certain Github private repository and push the commits.

In order to do this, I set up SSH public/private keys, uploaded the public key to Github and now I want to copy the private key into the web application's server's filesystem (essentially server of GAE) so that it can clone the repo first and push commits.

The problem is that I don't have access to write to the filesystem as it's running on Google App Engine, so I can't make use of copying the private key to the ~/.ssh location. The only place I have both read/write access is the tmp folder.

My first approach was seeing if I could copy the private key file into the tmp folder and use the env var GIT_SSH_COMMAND to specify that key while running the git commands. So something like: GIT_SSH_COMMAND='ssh -i /path/to/tmp/privatekey' git clone git@github.com:username/test-repo.git

However, when running the application, git is still looking at the folder ~/.ssh to authenticate, which I do not have access to write on.

My knowledge on ssh and git system is pretty limited - I would like to know if there is a workaround to this, and the application must be running on Google App Engine.

Rachel
  • 152
  • 9
  • Could you try the following documentation about [Accessing private GitHub repositories](https://cloud.google.com/cloud-build/docs/access-private-github-repos) and let me know if this works for you? – tzovourn Jun 05 '20 at 14:32

1 Answers1

0

git is still looking at the folder ~/.ssh to authenticate, which I do not have access to write on.

Double-check that with:

GIT_SSH_COMMAND='ssh -vi /path/to/tmp/privatekey' git clone git@github.com:username/test-repo.git

Git should be using your private key if you are using ssh -i, unless, as in here, you need to add -o IdentitiesOnly=yes.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250