gitgoogle-cloud-sdkgoogle-cloud-source-repos

ERROR : fatal: not a git repository (or any of the parent directories): .git cloud source repository


I am trying to push code from local windows to cloud source repository using cloud sdk the link i was following is

https://cloud.google.com/source-repositories/docs/authentication

when run the first command in my cloud sdk which is

gcloud init && git config --global credential.https://source.developers.google.com.helper gcloud.cmd

it got run without any issue but it did not generate .git folder in my local folder and when i run the second command that is

git remote add google https://source.developers.google.com/p/la-gcp-test/r/demo-repo

I got this error

fatal: not a git repository (or any of the parent directories): .git

All I want to do is to upload a simple index.html file from my local windows machine to cloud source repository using cloud sdk.


Solution

  • As you suspect, you're missing git init and this must have occurred before you can git remote add.

    If you haven't initialized a local repo before you come upon git remote add, then just git init before you git remote add

    I'm surprised the Google documentation doesn't include it.