Skip to content

Instantly share code, notes, and snippets.

@dustintheweb
Last active November 26, 2021 08:13
Show Gist options
  • Save dustintheweb/21c308b82a024fc8d585 to your computer and use it in GitHub Desktop.
Save dustintheweb/21c308b82a024fc8d585 to your computer and use it in GitHub Desktop.
Set up a Google Cloud Git Repo in SourceTree

###Setting up a Google Cloud Git Repo // now with SourceTree bonus!
*Note: this guide is relavent only to repos natively hosted on Google Cloud


**Prereq:** - OSX - SourceTree - git - A Google App Engine / Cloud project
###Admin Setup: **Set up an App Engine Git Repo** - read this: https://developers.google.com/cloud/devtools/repo/push-to-deploy

Git Init

$ my-mbpro: cd ~/path/projectDirectory
$ my-mbpro: git init

Grab the Repo Url

Set up SourceTree

  • create repo
  • menu: file > new/ clone > add working copy
  • enter path + name > ok
  • once added, open the repo via view > show bookmarks > click repo name
  • make your first commit
    then...
  • push repo
  • menu: repository settings > remotes
  • enter repo name + path (your repo url)
  • click dropdown > select unknown
  • add the google account email of for the project > ok
    (if prompted for a google password here, good. If not, click push to push the branch up - you will be prompted during this)

#####Your next step is based on your account security setup, follow the one that applies:

  • I Have 2-Factor Authentication Enabled:
    • https://console.developers.google.com
    • left panel > source code > releases
    • click the link "Configure your repository" in the first paragraph
    • in the second sentence, click the little help icon w/ a ?
    • click the link "generate your git credentials"
    • Create a file called .netrc in your home directory (~/.netrc).
    • Unfortunately, the syntax requires you to store your passwords in plain text, so make sure you modify the file permissions to make it readable only to you.
    • add the below credentials to your file .netrc file & paste in the provided name & pass
machine source.developers.google.com
login googleUsername
password yourPassword

And that's it! Subsequent git clone, git pull and git push requests will now be authenticated using the credentials specified in this file. - Add to SourceTree - menu: file > repository > push > tick master > ok - when prompted, paste token in the password field


###Client Setup:

Grab the Repo Url

Set up SourceTree

  • menu: file > new/ clone > clone repository
  • add the repo url > click once in the bookmark field
  • add user name / pass (same authentication method as described above)
  • choose destination / repo name > ok

🇺🇸

@nverwer
Copy link

nverwer commented Jun 10, 2015

Thanks for this walk-through!
I am also trying to use SourceTree on a Google Cloud Source Repo, but I get stuck when I try to access the left panel > source code > releases menu. It is not present in my developers console, I only have left panel > source code > browse.
Is this because I skipped the push-to-deploy step? I read the page you link to, but did not do what is described there, because I don't want the complexity of Jenkins/Maven/Gradle and all the other stuff.

Copy link

ghost commented Oct 6, 2021

In 2021 so much has changed that I can't do anything but add the project and hope that you will update this...

@diliupg
Copy link

diliupg commented Nov 26, 2021

Some of the things mentioned in this tutorial are now redundant. So this is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment