Debadatt
Debadatt

Reputation: 6015

git push cloud showing invalid authentication credentials error

I want to push an application to google cloud repository

I added the remote repository for git like this:

git remote add cloud  https://source.developers.google.com/p/abc/r/xxxxx

then I made a commit and executed git push cloud, but found the following error:

fatal: remote error:


Invalid authentication credentials.

    Please generate a new identifier:
      https://source.developers.google.com/new-password

Also clicking the link and verified in google can't even work.

Query:

How to push in google cloud?

Upvotes: 4

Views: 2087

Answers (2)

Peet Brits
Peet Brits

Reputation: 3265

After confirming my credentials in the current credential manager (thanks to VonC's answer for the link), what worked for me was to first check out the empty repository in a different folder

gcloud source repos clone <repo> --project=<project>

which will give a warning, because the repository is empty

warning: You appear to have cloned an empty repository.

and then I added my code to this folder, commit it locally on git, and then try to git push again

cd <folder>
# git add <...>
# git commit <...>
git push -u origin master

EDIT: This answer assumes you already installed and initialised Google Cloud SDK

Upvotes: 1

VonC
VonC

Reputation: 1328152

Make sure you have defined the right credential helper

git config credential.helper gcloud.sh

# Or, on Windows:

git config credential.helper gcloud.cmd

That way, you would not use the wrong credentials which might have been cached in the current credential manager, as in here.

And make sure you do own the remote repo.

Upvotes: 1

Related Questions