在Windows 10上使用Google Cloud SDK身份验证方法将Git推送到Google Cloud Source Repository的权限被拒绝(公钥) [英] Get Permission denied (publickey) for Git push to Google Cloud Source Repository with Google Cloud SDK authentication method on Windows 10

查看:111
本文介绍了在Windows 10上使用Google Cloud SDK身份验证方法将Git推送到Google Cloud Source Repository的权限被拒绝(公钥)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Google Cloud Source Repository用作远程存储库.我遵循了所有过程,使用Google Cloud SDK身份验证方法进行身份验证,该方法允许我不使用SSH密钥(如他们所说).

问题是:我总是得到权限被拒绝(公共密钥)致命:我尝试从 git push --all google 消息时无法从远程存储库读取.消息./p>

gcloud 命令在我的Windows PATH中( C:\ Users \ xxxxx \ AppData \ Local \ Google \ Cloud SDK \ ;),并且我的用户具有足够的权限因为我是Google Cloud中项目的所有者.

我知道此消息通常是一个简单的SSH密钥问题,可以通过将我的公共密钥添加到项目中来解决,但是该方法应该可以在没有ssh密钥的情况下工作,因此我想了解自己在做什么.

这是我按照Google Cloud Source Repository过程执行的前两个命令:

  gcloud init&&git config-全局证书.https://source.developers.google.com.helper gcloud.cmdgit remote add google ssh://username@gmail.com@source.developers.google.com:2022/p/my-website-project/r/my_website 

这2个效果很好.

也许有人可以帮助我找到解决该问题的方法.

谢谢.

解决方案

我遇到了同样的问题.
这两个命令对我也很有效:

  gcloud init&&git config-全局证书.https://source.developers.google.com.helper gcloud.cmdgit remote add google ssh://username@gmail.com@source.developers.google.com:2022/p/my-website-project/r/my_website 

但是这个没有用:

  git push --all google 

我必须编辑〜/.ssh/config 文件才能使其正常工作.它解决了我的问题.我加了:

 主机source.developers.google.com主机名source.developers.google.com用户username@gmail.comIdentityFile〜/.ssh/您的_private_key_file_registered_for_the_source_repo 

此处中了解有关〜/.ssh/config 文件的更多信息.>

I'm trying to use Google Cloud Source Repository as a remote repository. I followed all the procedures to authenticate with the Google Cloud SDK authentication method that allows me to not use SSH keys (as they say).

The problem is: I always get Permission denied (publickey) fatal: Could not read from remote repository. message when I try git push --all google.

The gcloud command is in my Windows PATH (C:\Users\xxxxx\AppData\Local\Google\Cloud SDK\;) and my user has enough permission as I'm the owner of the project in Google Cloud.

I know this message is usually a simple SSH key problem that can be resolved by adding my public key to the project, but this method is supposed to work without ssh keys, so I would like to learn what I am doing wrong.

Here the 2 first commands I made following the Google Cloud Source Repository procedure:

gcloud init && git config --global credential.https://source.developers.google.com.helper gcloud.cmd
git remote add google ssh://username@gmail.com@source.developers.google.com:2022/p/my-website-project/r/my_website

These 2 worked well.

Maybe someone could help me to find what to do to fix that.

Thank you.

解决方案

I had the same problem.
These two commands worked well for me too:

gcloud init && git config --global credential.https://source.developers.google.com.helper gcloud.cmd
git remote add google ssh://username@gmail.com@source.developers.google.com:2022/p/my-website-project/r/my_website

But this one didn't work:

git push --all google

I had to edit ~/.ssh/config file to make it work. It solved my problem. I added:

Host source.developers.google.com
    HostName source.developers.google.com
    User username@gmail.com
    IdentityFile ~/.ssh/your_private_key_file_registered_for_the_source_repo

Read more about ~/.ssh/config file here

这篇关于在Windows 10上使用Google Cloud SDK身份验证方法将Git推送到Google Cloud Source Repository的权限被拒绝(公钥)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆