- Sourcetree mac os ssh
- SourceTree SSH options on OS X
- 3 Answers 3
- Sourcetree Support
- Get started
- Knowledge base
- Products
- Jira Software
- Jira Service Management
- Jira Core
- Confluence
- Bitbucket
- Resources
- Documentation
- Community
- Suggestions and bugs
- Marketplace
- Billing and licensing
- Viewport
- Confluence
- Generate and Load SSH Keys into SourceTree with PuTTY
- Related content
- Still need help?
- Purpose
- Solution
- SourceTree on macOS keeps asking for SSH key password, or hangs if password is stored in keychain
- Set up an SSH key
- Set up SSH for Git on Windows
- Step 1. Set up your default identity
- Step 2. Add the key to the ssh-agent
- Step 3. Add the public key to your Account settings
- Set up SSH on macOS/Linux
- Step 1. Set up your default identity
- Step 2. Add the key to the ssh-agent
- Step 3. Add the public key to your Account settings
- Set up SSH with Sourcetree on Windows
- Step 1. Install Sourcetree and add your Bitbucket account
- Step 2. Create an SSH key
- Step 3. Install your private key on Pageant
- Step 4. Add the public key to your Account settings
- Set up SSH with Sourcetree on macOS
- Step 1. Install Sourcetree and add your Bitbucket account
- Step 2. Create an SSH key
- Step 3. Add the public key to your Account settings
Sourcetree mac os ssh
1. Personal access token
User settings (user settings)-> settings-> personal access token
Fill in the name (it is recommended to be consistent with the account for easy matching), the expiration date is set according to actual needs
Click «Create Personal Access Token», after successful creation, you will get the following, access token
Be sure to save it, once the page is refreshed, you will never see it again
2. Open Sourcetree and choose Preferences-> Account-> Add
Enter Gitlab server address
Enter username and password (password is the personal access token created in the first step)
Click Create Key
Remember this key, you need to use it later, this is the key of the certificate (password: 000000)
Copy the public key to the clipboard and click save ( If you can’t save it, quit sourcetree, open it again and try again )
Open Gitlab, user settings (user settings)-> settings-> SSH key
Paste the SSH key (public key) copied in Sourcetree to the location of the key above, and fill in the title (it is recommended to be consistent with the account for easy matching)
1. The account password is used to connect to the gitlab account and read the project list
2. When SSH is used for code version management, use SSH mode to do pull / push
3. Other operations
The ssh-add command is not used to permanently remember the private key you use. In fact, its role is to add the private key you specify to a session managed by ssh-agent. And ssh-agent is a temporary session service for storing private keys, which means that when you restart, the ssh-agent service will be reset, and the session will be invalid. Since ssh-agent is temporary, for Mac, where it can be permanently stored is obviously Keychain. After executing ssh-add -K privateKey, you can open the Keychain (keychain) in the preferences to observe before and after Changes, are there more SSH entries.
Temporarily add the private key to the ssh-agent: ssh-add privateKey (private key)
Permanently add the private key to the keychain: ssh-add -K privateKey (private key), the recommended way, do not need to add every time
The password entered here is the private key certificate password: 000000
4. Basic verification methods
Create an account and save it successfully, prove that the account is usable
The location in the lower left corner shows that this is a Git repository, which proves that the connection to the remote library is normal.
Источник
SourceTree SSH options on OS X
I’m trying to connect to GitHub through SourceTree on OS X using SSH. Even though I can connect fine command line, I can’t seem to work with any repo through SSH in SourceTree with the error:
All the help topics I have found online suggest configuring the SSH client in SourceTree. However, all of that documentation is for the Windows version. How can I access the SSH Preferences on the OS X version of SourceTree?
3 Answers 3
It was hard to find this answer, but it looks like the way to do this is to just add the ssh key to your keychain in Mac OS. I found an answer here: https://wiki.hpcc.msu.edu/display/hpccdocs/Adding+a+Private+Key+to+Your+Mac+OSX+Keychain
On Mac OSX, the native SSH client can use the built-in keychain directly. To add your private key to the keychain simply use the command:
As an example if your private key is stored at
/.ssh and is named id_rsa, you would use the command:
You will then be prompted for your passcode, which will be stored in your keychain. After this you should be ready for a password-less login.
After I added my SSH key, SourceTree started authenticating correctly.
1/18/2017 EDIT: Apparently OSX Sierra made it so you don’t get your keys back when you login, so you’ll have to do this every time you start your computer. BUT, there’s a nice way to fix this from the Apple stack exchange: https://apple.stackexchange.com/questions/48502/how-can-i-permanently-add-my-ssh-private-key-to-keychain-so-it-is-automatically
Just follow the steps in the answer with «Update Jan 2017»
I tried to google this as well, since adding custom SSH Keys with OpenSSH is available in the Tools section in SourceTree(ST) for Windows.
Although I was able to ssh -T successfully from terminal, ST for Mac was denying access.
Finally, I thought of adding the keys to my agent again. Now, when I checked the list of identities added — there were none (ssh-add -l). Just add your ssh key to the agent and ST will automatically pick your key and grant access.
I had the same problem, except the error message I got sounded:
Instead of trying and erring with lots of different answers, I went after the root cause of the problem. I found out that the ssh configuration file, which is
/.ssh/config , plays a role in this matter. In my case it contained two records:
When I swapped both records, ssh to github worked again, but ssh to 145.20.188.96 did not work anymore. This prompted me to read a manual for the ssh config file. Apparently, the first occurrence of host * is used for every host, so the github host is shadowed entirely. The following solution solved the problem: Just let the first record refer only to the designated host instead of all hosts:
This works fine and it solved the problem. Even better is to confine github to the correct host too. So I guess that you want to look for the problem in
/.ssh/config . I reckon that this solution will also work in situations other than Sourcetree on MacBook only.
Источник
Sourcetree Support
Get started
Knowledge base
Products
Jira Software
Project and issue tracking
Jira Service Management
Service management and customer support
Jira Core
Manage any business project
Confluence
Bitbucket
Git code management
Resources
Documentation
Usage and admin help
Community
Answers, support, and inspiration
Suggestions and bugs
Feature suggestions and bug reports
Marketplace
Billing and licensing
Frequently asked questions
Viewport
Confluence
Generate and Load SSH Keys into SourceTree with PuTTY
Related content
Still need help?
The Atlassian Community is here for you.
Platform Notice: Server and Data Center Only — This article only applies to Atlassian products on the server and data center platforms .
Purpose
The goal of this article is to guide users to generate and load SSH keys into SourceTree using PuTTY.
Solution
Steps:
1. To generate an SSH Key, select Tools > Create or Import SSH Keys. This window should pop up:
2. Click Generate, and move the mouse randomly until a key is generated:
3. A public key and a private key should appear. Save them both by clicking Save public key (save as .pub filetype), and Save private key (save as .ppk filetype):
4. This is how the .pub and the .ppk files should appear in your .ssh folder, along side with some other files:
SourceTree might prompt you to load the private key. Simply load the .ppk file.
5. Add your public key in your remote server (eg. Bitbucket).
Now, you should finally be able to use SSH as a method for git operations between local and remote.
The goal of this article is to guide users to generate and load SSH keys into SourceTree using PuTTY.
Источник
SourceTree on macOS keeps asking for SSH key password, or hangs if password is stored in keychain
I’ve been happily using SourceTree on my Mac for years and rarely had problems. A couple of weeks ago after updating macOS it suddenly stopped working altogether. Whenever I try to clone/fetch/push/pull/whatever to any of my Git repositories, SourceTree either
- keeps asking for my SSH key password over and over again immediately after I enter it (if I don’t save it in the keychain), or
- just hangs forever in the progress window if the password is stored in the keychain.
It’s not an issue with the repositories. It’s happening for Github too, with the exact same repos and settings that worked before. The key has chmod 400, same as before, and it’s the default key
/.ssh/id_rsa. Tried using the embedded Git in SourceTree and System Git, to no avail. Another app that I switched to in the meantime works normally.
I can’t remember exactly which macOS update caused the issues, but I’m now using the latest macOS Catalina 10.15.4 and SourceTree 4.0.1. I wiped the disk completely clean and re-installed everything from scratch due to another problem, but it still doesn’t work. I couldn’t find anything about new access restrictions that prevent SourceTree from accessing the key itself, or how I could allow access if that’s the case. This is driving me nuts, I’ve switched to another app in the meantime, but I’d really like to continue using SourceTree if it lets me.
EDIT: All my repos are affected by this problem when I’m using SourceTree on macOS. All repos are used by other people as well, it also works for me on my Mac when I use another app. Even SourceTree for Windows on my other laptop, all of those work with the same key.
Источник
Set up an SSH key
When you set up SSH key, you create a key pair that contains a private key (saved to your local computer) and a public key (uploaded to Bitbucket). Bitbucket uses the key pair to authenticate anything the associated account can access. This two-way mechanism prevents man-in-the-middle attacks.
This first key pair is your default SSH identity. If you need more than a default identity, you can set up additional keys.
For security reasons, we recommend that you generate a new SSH key and replace the existing key on your account at least once a year.
You can’t use the same key between accounts. You must create new keys for each individual Bitbucket account.
Set up SSH for Git on Windows
Use this section to create a default identity and SSH key when you’re using Git on Windows. By default, the system adds keys for all identities to the /Users/ /.ssh directory.
Step 1. Set up your default identity
From the command line, enter ssh-keygen .
For Windows 7 or earlier
You can only enter ssh-keygen into the Git Bash window. It won’t work in the Command prompt.
The command prompts you for a file to save the key in:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/emmap1/.ssh/id_rsa):
2. Press enter to accept the default key and path, /c/Users/ /.ssh/id_rsa .
We recommend keeping the default key name unless you have a reason to change it. To create a key with a non-default name or path, specify the full path to the key. For example, to create a key called my-new-ssh-key , enter the Windows path, shown here:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/emmap1/.ssh/id_rsa): c:\Users\emmap1\.ssh\my-new-ssh-key
3. Enter and re-enter a passphrase when prompted.
The command creates your default identity with its public and private keys. The whole interaction looks similar to this:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/emmap1/.ssh/id_rsa):
Created directory ‘/c/Users/emmap1/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/emmap1/.ssh/id_rsa.
Your public key has been saved in /c/Users/emmap1/.ssh/id_rsa.pub.
The key fingerprint is: e7:94:d1:a3:02:ee:38:6e:a4:5e:26:a3:a9:f4:95:d4 emmap1@EMMA-PC
4. List the contents of .ssh to view the key files.
You should see something like the following:
$ dir .ssh
id_rsa id_rsa.pub
The command displays two files, one for the public key (for example id_rsa.pub ) and one for the private key (for example, id_rsa ).
Step 2. Add the key to the ssh-agent
If you don’t want to type your password each time you use the key, you’ll need to add it to the ssh-agent.
To start the agent, run the following:
$ eval $(ssh-agent)
Agent pid 9700
Enter ssh-add followed by the path to the private key file:
Step 3. Add the public key to your Account settings
From Bitbucket, choose Personal settings from your avatar in the lower left.
Click SSH keys. If you’ve already added keys, you’ll see them on this page.
Open your .ssh/id_rsa.pub file (or whatever you named the public key file) and copy its contents.
You may see an email address on the last line. It doesn’t matter whether or not you include the email address.
From Bitbucket, click Add key.
Enter a Label for your new key, for example, Default public key .
Paste the copied public key into the SSH Key field.
Click Save.
Bitbucket sends you an email to confirm the addition of the key.
Return to the command line and verify your configuration and username by entering the following command:
$ ssh -T git@bitbucket.org
The command message tells you which of your Bitbucket accounts can log in with that key.
If you get an error message with Permission denied (publickey) , check the Troubleshoot SSH issues page for help.
Now that you’ve got an SSH key set up, use the SSH URL the next time you clone a repository. If you already have a repository that you cloned over HTTPS, change the remote URL for your repository to its SSH URL.
Edit an SSH key
After you add a key, you can edit the key’s Label but not the key itself. To change the key’s contents, you need to delete and re-add the key.
Set up SSH on macOS/Linux
Use this section to create a default identity and SSH key on macOS or Linux. By default, the system adds keys to the /Users/ /.ssh directory on macOS and /home/ /.ssh on Linux.
Step 1. Set up your default identity
1. From the terminal, enter ssh-keygen at the command line.
The command prompts you for a file to save the key in:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/emmap1/.ssh/id_rsa):
2. Press the Enter or Return key to accept the default location.
We recommend you keep the default key name unless you have a reason to change it.
To create a key with a name or path other than the default, specify the full path to the key. For example, to create a key called my-new-ssh-key , enter a path like the one shown at the prompt:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/emmap1/.ssh/id_rsa): /Users/emmap1/.ssh/my-new-ssh-key
3. Enter and re-enter a passphrase when prompted.
The command creates your default identity with its public and private keys. The whole interaction will look similar to the following:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/emmap1/.ssh/id_rsa):
Created directory ‘/Users/emmap1/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/emmap1/.ssh/id_rsa.
Your public key has been saved in /Users/emmap1/.ssh/id_rsa.pub.
The key fingerprint is:
4c:80:61:2c:00:3f:9d:dc:08:41:2e:c0:cf:b9:17:69 emmap1@myhost.local
The key’s randomart image is:
+—[ RSA 2048]—-+
|*o+ooo. |
|.+.=o+ . |
|. *.* o . |
| . = E o |
| o . S |
| . . |
| . |
| |
| |
+——————+
4. List the contents of
/.ssh to view the key files.
/.ssh
id_rsa id_rsa.pub
The command displays two files, one for the public key (for example id_rsa.pub ) and one for the private key (for example, id_rsa ).
Step 2. Add the key to the ssh-agent
If you don’t want to type your password each time you use the key, you’ll need to add it to the ssh-agent.
To start the agent, run the following:
$ eval `ssh-agent`
Agent pid 9700
Enter ssh-add followed by the path to the private key file:
macOS $ ssh-add -K
(macOS only) So that your computer remembers your password each time it restarts, open (or create) the
/.ssh/config file and add these lines to the file:
Step 3. Add the public key to your Account settings
From Bitbucket, choose Personal settings from your avatar in the lower left.
Click SSH keys.
If you’ve already added keys, you’ll see them on this page.
In your terminal window, copy the contents of your public key file. If you renamed the key, replace id_rsa.pub with the public key file name.
On Linux, you can cat the contents:
On macOS, the following command copies the output to the clipboard:
Select and copy the key output in the clipboard.
If you have problems with copy and paste, you can open the file directly with Notepad. Select the contents of the file (just avoid selecting the end-of-file characters).
From Bitbucket, click Add key.
Enter a Label for your new key, for example, Default public key .
Paste the copied public key into the SSH Key field.
You may see an email address on the last line when you paste. It doesn’t matter whether or not you include the email address in the Key.
Click Save.
Bitbucket sends you an email to confirm the addition of the key.
Return to the terminal window and verify your configuration and username by entering the following command:
$ ssh -T git@bitbucket.org
The command message tells you which of your Bitbucket accounts can log in with that key.
If you get an error message with Permission denied (publickey) , check the Troubleshoot SSH issues page for help.
Now that you’ve got an SSH key set up, use the SSH URL the next time you clone a repository. If you already have a repository that you cloned over HTTPS, change the remote URL for your repository to use its SSH URL.
Edit an SSH key
After you add a key, you can edit the key’s Label but not the key itself. To change the key’s contents, you need to delete and re-add the key.
Set up SSH with Sourcetree on Windows
Use this section to generate an SSH key using Sourcetree. When you create an SSH key with Sourcetree, you can save the public and private key wherever you want locally. You may want to create an SSH directory when you do, so that you can refer to your SSH keys whenever you need them.
Step 1. Install Sourcetree and add your Bitbucket account
If you don’t yet have Sourcetree, go to https://www.sourcetreeapp.com/ and click the Download free button.
Click the .exe file to install Sourcetree. Refer to the Install Sourcetree page for more details.
You may see the Load SSH Key? dialog after installation. Click No if you don’t have one and want to use Sourcetree to create one.
Add your account and select SSH as the Preferred Protocol. If you don’t connect your account during set up, click Remote to open the Remote repositories page and click Add an account.
Step 2. Create an SSH key
From Tools, select Create or Import SSH Keys.
From the PuTTY Key Generator dialog, click the Generate button.
As the SSH key generates, hover your mouse over the blank area in the dialog. It may take a minute or two.
When SSH key generation is complete, you see the public key and a few other fields.
Enter a passphrase for your SSH key in the Key passphrase and Confirm passphrase fields.
Click Save public key. From the save dialog, choose where to save your public key, name the file with the .pub file extension, and click Save.
Click Save private key. From the save dialog, choose where to save your private key, name the file, and click Save.
Close the PuTTY Key Generator dialog.
Step 3. Install your private key on Pageant
Sourcetree comes with an SSH authentication agent called Pageant. Load your private key into Pageant to automatically authenticate so that you don’t need to enter your passphrase.
Double-click the Pageant (PuTTY Authentication Agent) icon in your system tray to open the Pageant Key List dialog.
Click the Add Key button to open the Select Private Key File dialog.
Navigate to the private key file you saved in Step 1 and click Open.
Enter the passphrase for your SSH key and click OK.
Pageant shows your key in the running list.
Click Close.
Step 4. Add the public key to your Account settings
From Sourcetree, open the PuTTY Key Generator dialog by going to Tools > Create or Import SSH Keys.
Click Load, navigate to your SSH folder, and click the private key. Make sure you’re looking at All files if you don’t see your private key.
Enter your passphrase for the SSH key and click OK.
Copy the public key in the first field.
From Bitbucket, choose Personal settings from your avatar in the lower left.
The Account settings page opens.
Click SSH keys.
If you’ve already added keys, you’ll see them on this page.
Click Add key.
Enter a Label for your new key, for example, Default public key .
Paste the copied public key into the SSH Key field.
Click Save.
Bitbucket sends you an email to confirm the addition of the key.
Now that you’ve got an SSH key set up, use the SSH URL the next time you clone a repository. If you already have a repository that you cloned over HTTPS, change the remote URL for your repository to its SSH URL.
Edit an SSH key
After you add a key, you can edit the key’s Label but not the key itself. To change the key’s contents, you need to delete and re-add the key.
Set up SSH with Sourcetree on macOS
When you create an SSH key with Sourcetree on macOS, you can only create one key. You’ll need to use the command line if you want additional keys.
Step 1. Install Sourcetree and add your Bitbucket account
If you don’t yet have Sourcetree, go to https://www.sourcetreeapp.com/ and click the Download free button.
Open the ZIP file to install Sourcetree. Refer to the Install Sourcetree page for more details.
If you don’t connect your account during set up, you can add it from the Accounts tab by selecting Preferences from the Sourcetree menu.
Step 2. Create an SSH key
Follow these steps if you don’t already have an SSH key for an account. If you do have an SSH key and you want to generate another key, you’ll have to use the terminal because you can’t use Sourcetree to create a second key.
Creating an SSH key looks something like this:
From the Sourcetree menu, select Preferences.
Click the Accounts tab, select the account where you want to add the SSH key and click Edit.
Change the Protocol to SSH if it’s not already selected.
Hold down the OPTION key on your keyboard to see the Generate Key button.
If you’ve already generated an SSH key for this account from Sourcetree, the OPTION key won’t do anything. Use your existing key or generate another key from the terminal.
Click Generate Key.
Enter a passphrase for the SSH key in the Passphrase and Confirm Passphrase fields.
Click Create.
Step 3. Add the public key to your Account settings
From Bitbucket, choose Personal settings from your avatar in the lower left.
The Account settings page opens.
Click SSH keys.
If you’ve already added keys, you’ll see them on this page.
Select your account from your Accounts tab in Sourcetree.
Click the Copy to Clipboard button to copy your public SSH key.
From Bitbucket, click Add key.
Enter a Label for your new key, for example, Default public key .
Paste the copied public key into the SSH Key field.
Click Save.
Bitbucket sends you an email to confirm the addition of the key.
Now that you’ve got an SSH key set up, use the SSH URL the next time you clone a repository. If you already have a repository that you cloned over HTTPS, change the remote URL for your repository to its SSH URL.
Edit an SSH key
After you add a key, you can edit the key’s Label but not the key itself. To change the key’s contents, you need to delete and re-add the key.
Источник