I'm trying to upload a dummy repository to Google Source Repository. I'm doing this to learn how to use this. The steps I did were:
Open a GCP VM, created a directory named
test_git
and rungit init
Created a couple of files and folders. Edited the files.
Did a
git add <file>
Did a
git commit
Went to Google Source Repository, created an empty repository (same name as the directory) and then, on the VM, did
git remote add google ssh://<[email protected]>@source.developers.google.com/p/<PROJECTID>/r/test_git
This command was found in the Source Repository under the "Push code from local git repository
"
- Did
git push --all google
When I do this, I get an error that says Permission denied (publickey). fatal: Could not read from remote repository
.
I honestly don't get it, because around 40 minutes ago I did a git push
for some actual code (just one python file) and it actually worked (maybe because angels allowed it). And now that I followed some guides, read about how to use git and all stuffs, I'm stuck with this and I don't understand why. I also set a SSH key (generated with PuTTY
) and registered it, but it didn't worked. What I'm doing wrong?
I was able to replicate your problem when I didn't have an SSH key configured on CSR. Here's a post related to your concern and I suggest you double check your managed SSH keys.
If the SSH key from PuTTY didn't worked, then you can try generating a new SSH key using terminal (use Git Bash if you're using Windows):
id_rsa.pub
and paste the entire text to Key when registering the SSH key on Cloud Source Repository. For Key Name, it should be something that is easy for you to remember as future reference.Or as an alternative, you can follow this documentation to connect via HTTPS instead of SSH and run a credential helper script so you don't need to configure SSH keys:
Windows:
Linux or MacOS:
Here's a reference if you want to dig deeper on credential helpers.
Another thing that could help you troubleshoot your problem is to review your Git configuration by running this command: