Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SourceTree for Windows not working

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?

like image 921
Koray Tugay Avatar asked Mar 21 '13 12:03

Koray Tugay


3 Answers

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.

like image 176
bojer Avatar answered Oct 26 '22 10:10

bojer


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)

like image 36
weseze Avatar answered Oct 26 '22 12:10

weseze


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]...
like image 30
jhoanegar Avatar answered Oct 26 '22 11:10

jhoanegar