git - 在没有 gcloud 的情况下克隆 Google Source Repository

标签 git gcloud google-cloud-source-repos

我目前正在克隆 Google Cloud Source 存储库中存在的 git 存储库

gcloud source repos clone sample_repo --project=sample_project

我可以在不使用 gcloud 的情况下克隆 Google Cloud Source Repository 中的 git 存储库吗? 喜欢,

git clone https://source.developers.google.com/p/sample_project/r/sample_repo

最佳答案

gcloud 在克隆时不会做太多事情,它只会设置凭据。事实上,如果你运行

$ gcloud source repos clone default --dry-run

命令(带有 --dry-run 标志)您将看到 git 命令 gcloud 在后台运行:

git clone https://source.developers.google.com/p/YOUR_PROJECT/r/default\ --config credential.helper='!gcloud auth git-helper --account=YOUR_ACCOUNT --ignore-unknown $@'

gcloud credential helper 本质上只是为帐户提供访问 token 。因此,如果您有办法获取凭据,则可以通过这种方式将它们连接到 git 中。

关于git - 在没有 gcloud 的情况下克隆 Google Source Repository,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50129412/

相关文章:

github - 从 bitbucket 克隆 repo 时出现 Google Cloud Platform 错误

github - 自动将 GitHub 镜像到 GCP 源存储库?

git - Windows 终端 - 通过 oh-my-posh/posh-git Set-Theme 错误自定义 PowerShell?

git - 在 Docker 中,git-lfs 给出错误 : credentials for https://github. ... 未找到

gitlab不创建 repo

windows - 如何在具有管理员权限的 Windows 任务计划程序中设置 Powershell 脚本?

git - 在提交之前保存修改的日志

postgresql - Gcloud Sql postgres 时区问题

gcloud - 普通的 console.warn() 出现在 serverity "ERROR"的日志中

google-cloud-platform - 将 python 库从 Cloud Source Repository 安装到 Cloud Run 容器