通过Windows 10上的Google Cloud SDK身份验证方法,获得Google Cloud Source存储



我正在尝试将Google Cloud源存储库用作远程存储库。我遵循所有程序来验证Google Cloud SDK身份验证方法,该方法使我不使用SSH键(如他们所说)。

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

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

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

在这里,我按照Google云源存储库过程制作的两个第一个命令:

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 文件的更多信息,

我有同样的问题,而我发现的解决方案都没有。事实证明,Google Cloud Source存储库不喜欢我的SSH键。(也许钥匙太短了?)无论如何,我尝试切换到ECDSA键,而错误消失了。

ssh-keygen -t ecdsa -C "myuser@mygmailhost.com"

我必须在〜/.ssh/config的新密钥中替换我以前的密钥。

我在试图将现有存储库的遥控器设置为Google Cloud Source Repos时,在Linux(Mint/Ubuntu)上也有相同的问题。这就是您正在尝试的样子。但是,这是Expo Cli Quickstart生成的空GIT存储库,该存储库根本没有文件或源历史记录。

我所做的是克隆Google Cloud Source存储库上的现有存储库到我的计算机,添加虚拟文件,提交并推送。那对我有用。希望它对您有用。

在浏览器中打开https://source.developers.google.com/new-password,登录并按照显示的说明进行登录。在我的情况下它起作用。

有类似的问题,因此尝试了两件事:

1-此主题中的建议

做了gcloud init并创建和配置〜/.ssh/config,但这并不能解决问题。

2-然后在这里尝试了建议,它起作用了...

使用git时如何解决拒绝(publicKey)错误的权限?

在我(非常不寻常的)情况下,我的公司采用了Google Workspace。这创建了一个新的Google Workspace帐户,其名称与我的原始帐户(original@domain.com)相同,然后将我的原始帐户的名称更改为[my name]%[company's domain].com@gtempaccount.com

由于GCP权限与原始帐户相关联(现在称为[my name]%[company's domain].com@gtempaccount.com),因此我获得了拒绝错误的权限。我的Git配置中定义的远程URL使用了原始电子邮件(original@domain.com),现在与新创建的Google Workspace帐户关联,并且该帐户没有访问云源存储库的权限。

添加一个名为 config的文件(无文件扩展名,即无.txt扩展程序)在OpenSSH目录中(在Windows上,它应该在C:Usersmyusername.ssh中),其中以下内容:

Host source.developers.google.com
    HostName source.developers.google.com
    User myemail@mydomain.com
    IdentityFile ~/.ssh/my-private-key-file

this:

git远程添加google ssh://username@gmail.com@source.developers.google.com:2022/p/my-website-project/r/my_website

应该是这样:

git远程添加Googlehttps://source.developers.google.com/p/[project_name]/r/[repo_name]

最新更新