Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Clone github private repository using cloudbuild trigger

Hi Everyone,

I am trying to clone private GitHub repository and then push content to gcs , it is working with cloud build trigger using public GitHub , i have also integrated private GitHub in cloud build but when i try to clone it it through error  

"fatal: could not read Username for 'https://github.myrepo.com': No such file or director "fatal: could not read Username for '"

Pls suggest how to clone external enterprise GitHub repository using cloudbuild? 

0 5 3,969
5 REPLIES 5

Hi @FalconSid ,

You may want to check/follow the steps documented on this link: https://cloud.google.com/build/docs/access-github-from-build

Hope this helps.

Hello @anjelisa  thanks for the update , actually I wanted connect using https ssh not allowed in my organization to connect github.example.com

Hello @FalconSid 

In order to connect to Private Git Repo, you need to save the Private SSH key in Secret Manager. And use that secret key during your build step. 

@PrashantP  thanks for the help, but to ssh keys My enterprise GitHub to be connected on port 22 but it is not opened in my organisation so I need some other option using I can clone or copy github enterprise repo data to gcs using cloudbuild.

I don't understand 3/4 of what i'm trying to do 🙂  Very confusing.

i cloned a public github repository, made it private.  it had a button that you click that would open Google cloud and push ?? the repository to cloud.

I'm trying to do that with my private github repository, but it does not seem to be working the same.  It just spins and says clone image error or something.

Here is the link :

https://console.cloud.google.com/cloudshell/editor?shellonly=true&cloudshell_image=gcr.io/cloudrun/b...

Is there not something straightforward i can do to make this work?