Clone Google Source Repository without gcloud

可紊 提交于 2021-02-07 08:12:53

问题


I am currently cloning the git repository present in Google Cloud Source repository using

gcloud source repos clone sample_repo --project=sample_project

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

回答1:


gcloud does not do much when cloning, it only sets up credentials. In fact if you run

$ gcloud source repos clone default --dry-run

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



来源:https://stackoverflow.com/questions/50129412/clone-google-source-repository-without-gcloud

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!