gpt4 book ai didi

git - 在Windows 10上使用Google Cloud SDK身份验证方法将Git推送到Google Cloud Source Repository的权限被拒绝(公钥)

转载 作者:太空狗 更新时间:2023-10-29 13:03:43 25 4
gpt4 key购买 nike

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

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

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

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

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

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

这两个效果很好。

也许有人可以帮我找到解决方法。

谢谢。

最佳答案

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

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 文件才能让它工作。它解决了我的问题。我补充说:

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 文件的信息 here

关于git - 在Windows 10上使用Google Cloud SDK身份验证方法将Git推送到Google Cloud Source Repository的权限被拒绝(公钥),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54961649/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com