Search code examples
gitgoogle-cloud-storageatlassian-sourcetree

How use Google Cloud on Source Tree?


I just created a new Repo in Google Cloud and wanna use the Source Tree app as controllers for my git interactions.

But I keep been asked this password for push. enter image description here

Is no my Google account password I already setup the 2-verification password, but still not able to create this password.

EDIT: If I try to follow this guide Set Up a Google Cloud Git Repo In SourceTree

It says:

  1. https://console.developers.google.com
  2. Left panel > source code > releases
  3. Click the link "Configure your repository" in the first paragraph
  4. In the second sentence, click the little help icon w/ a ?
  5. Click the link "generate your git credentials"

On Step 2 there is no "source code/releases" option enter image description hereenter image description here

And If I try to go on Step 4 "Git Credentials", in credentials only have API Credentials, not Git. enter image description here


Solution

  • Recomended way (with gcloud credentials)

    I found a workaround to get it work (macOS):

    cd myproject
    git config credential.helper gcloud.sh
    

    You must be authenticated in your local gcloud CLI and have it in your $PATH. Then start SourceTree through the Terminal:

    open /Applications/SourceTree.app/Contents/MacOS/SourceTree
    

    This will propagate your $PATH to SourceTree in order to make the script git-credentials-gcloud.sh available.

    I managed to find a solution that does not involved the Terminal. You should add the following in the Info.plist of the SourceTree.app package (/Applications/SourceTree.app/Contents/Info.plist), at the end of the main <dict> item:

    <?xml version="1.0" encoding="UTF-8"?>
    <plist .....
    <dict>
    ...
    ...
        <key>LSEnvironment</key>
        <dict>
          <key>PATH</key><string>CONTENT OF YOUR $PATH</string>
        </dict>
    </dict>
    

    Then you need to flush the macOS cache by

    • Rename SourceTree.app to SourceTree2.app
    • Rename SourceTree2.app to SourceTree.app

    You are done, SourceTree should now be able to use the gcloud credentials.

    With password:

    Browse https://source.developers.google.com/auth/start?scopes=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform