1
votes

I am able to see git already installed in cloud shell. Also, when i fire 'git config --list' command i get below output.

core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
credential.https://source.developers.google.com.helper=gcloud.sh
core.repositoryformatversion=0
core.filemode=true
core.bare=false

Which credentials are these? And how can I connect to my github account?

Thanks in advance.

3

3 Answers

0
votes

As per the GCP documentation you can add your github account to the GCP Cloud Shell to upload your file to private git repository.

0
votes

First you need to add your ssh key to your deploy:

-Login to GitHub.

-In the upper-right corner, click your profile photo, then click Your profile.

-On your profile page, click Repositories, then click the name of your repository.

-From your repository, click Settings.

-In the sidebar, click Deploy Keys, then click Add deploy key.

-Provide a title, paste your public SSH key from workingdir/id_github.pub.

-Select Allow write access if you want this key to have write access to the repository. A deploy key with write access lets a deployment push to the repository.

-Click Add key.

-Delete the SSH key from your disk:

rm id_github*

Once you do that, I found a some documentation for generate credentials that maybe you can use.

for connect git account to google look this documentation and then you continue with the part of the git configuration

and for the part that you ask for the credentials find this documentation this is the Google credentials

0
votes

Thank you everyone for your answers. I'll mention what worked for me.

I set up git configuration using

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

when I cloned my private repo using,

git clone https://[your-git-repo].git

I had to enter my GitHub password. Then I performed whatever changes I had to make and after commiting did

git push

Again I had to provide my github password and the changes were pushed to my private repo. Please let me know if there is any better/ideal way to achieve the same.