I am trying to run gitlab on Google Cloud Platform. I followed this tutorial: https://docs.gitlab.com/ce/install/google_cloud_platform/index.html but now I am at the point when I cannot push the commit to the remote.

git@ Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The SSH key is added to the Google Cloud Platform VM as well as Gitlab account. I believe I have to enable git over ssh somehow but not really sure how these things go with Google Cloud Platform's security.

  • have you tried SSH-ing into the machine using gcloud so that it can add the instance to your list of known hosts? gcloud compute --project "project-name" ssh --zone "europe-west2-c" "instance-name" – Jan Vladimir Mostert Mar 18 '18 at 9:22
  • Added my key manually in VM management and SSH under my username worked. The command you mentioned worked too, I think there has to be some way to add git user too. Not really sure how this works though. – Jan Richter Mar 18 '18 at 9:36

So the problem was somewhere else.

I recently changed the IP address of the VM (to have a static one). Unfortunately, I forgot to change the IP in GitLab settings so the clone links are still pointing to the old one. Hence the Could not read from remote repository.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.