SourceTree for Windows not working

22,746

Solution 1

It seems like using SourceTree on windows you have to use Putty Agent. OpenSSH keys do not work.

If you have only OpenSSH key:

  1. click Create or import SSH keys in Tools menu
  2. in putty key generator select Import key from Conversions menu
  3. select your private key and click on save private key

You now have PPK file containing your key.

In Source Tree Launch SSH Agent from tools menu and browse to your PPK file.

All operations should now work fine.

Solution 2

This works if you authenticate using a public/private key pair:

  1. Open Sourcetree and go to "Tools > Create or Import SSH Keys" (this will open a PuTTY Key Generator window) and click on "Generate".

  2. Once generated go to drupal.org and navigate to "My account > Profile > SSH Keys" and click "Add a public key".

  3. Copy the generated public key from the "PuTTY Key Generator" window ("Public key for pasting into OpenSSH authorized_keys file:") to drupal.org and save it.

  4. In the "PuTTY Key Generator" window enter a "Key passphrase" and "Confirm passphrase" and click "Save private key". Make sure to save it somwhere where you can find it again.

  5. Close the "PuTTY Key Generator" window and in SourceTree go to "Tools > Launch SSH Agent (Pageant)". You should be able to select your private key file here. (the one you just saved)

  6. Add your repository with the link provided by drupal.org. ([email protected]:project/your_project.git)

Solution 3

You don't need to use Putty in Windows but it is recommended, otherwise you'll have to re-add your ssh key every time you start SourceTree.
To do this go to 'Tools -> Add SSH Key...' and select the key that you provided in your cloud server (Git, BitBucket...). Now you'll be able to push/pull correctly provided you cloned your repository using the ssh url.
Keep in mind that this may apply to you only if you can successfully push/pull from the command line, if you don't then you have some other kind of problem.
If you accidentally cloned your repository using the https url then:

git remote set-url <remote> <ssh-uri>

Like:

git remote set-url origin [email protected]...
Share:
22,746
Koray Tugay
Author by

Koray Tugay

Crappy software developer who does not like self-promoting profiles.

Updated on July 21, 2020

Comments

  • Koray Tugay
    Koray Tugay almost 4 years

    When I type git pull from command line, I can get the code without any problems.

    When I open SourceTree for Windows, and try a Pull, I get:

    git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
    fatal: Could not read from remote repository.
    Please make sure you have the correct access rights
    and the repository exists.
    
    
    
    Completed with errors, see above.
    

    What might I be doing wrong?

  • Koray Tugay
    Koray Tugay about 11 years
    Thank you but I am not trying to push anything to drupal? It is our own server.
  • geoidesic
    geoidesic about 8 years
    What if you don't want to use keys and just use a password instead? Sourcetree for windows doesn't seem to allow this.
  • Roeland Van Heddegem
    Roeland Van Heddegem over 7 years
    to make an OpenSSH key execute the ssh-keygen.exe application (<GIT-installation-directory>\usr\bin) and follow the defaults. This places the id_rsa and id_rsa.pub files in the <user>\.ssh directory.