不使用gcloud克隆Google Source Repository [英] Clone Google Source Repository without gcloud
问题描述
我当前正在使用
gcloud source repos clone sample_repo --project=sample_project
是否可以在不使用gcloud的情况下克隆Google Cloud Source Repository中存在的git存储库?喜欢,
Can I clone git repository present in Google Cloud Source Repository without using gcloud? Like,
git clone https://source.developers.google.com/p/sample_project/r/sample_repo
推荐答案
克隆时gcloud不会做很多事情,它只会设置凭据.实际上,如果您运行
gcloud does not do much when cloning, it only sets up credentials. In fact if you run
<代码>$ gcloud source repos clone default --dry-run
命令(带有-dry-run
标志),您将看到 git
命令 gcloud
在后台运行:
command (with --dry-run
flag) you will see the git
command gcloud
runs under the hood:
<代码>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凭证帮助程序实际上只是为该帐户提供访问令牌.因此,如果您有获取凭证的方法,可以通过这种方式将其连接到git中.
gcloud credential helper essentially just provides access token for the account. So if you have a way to get credentials you can wire in them into git this way.
这篇关于不使用gcloud克隆Google Source Repository的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!