在 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

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

问题描述

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

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).

问题是:当我尝试 git push --all google 时,我总是得到 Permission denied (publickey) fatal: Could not read from remote repository. 消息.

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

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

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

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

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.

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

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

这两个效果很好.

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

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

谢谢.

推荐答案

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

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

但是这个没用:

git push --all google

我必须编辑 ~/.ssh/config 文件才能使其工作.它解决了我的问题.我补充说:

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

阅读更多关于~/.ssh/config文件这里

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

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