问题
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