4

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
sag
  • 5,333
  • 8
  • 54
  • 91

1 Answers1

7

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.

cherba
  • 8,681
  • 3
  • 27
  • 34
  • This worked perfectly for me, with one small change. Instead of: `--config credential.helper=`, y used: `--config credential.https://source.developers.google.com/.helper=` – andresgottlieb Sep 22 '21 at 13:00