Accessing a SourceCraft repository with an SSH key
To authenticate in SourceCraft and access repositories, you can use an SSH key.
To access a SourceCraft repository with an SSH key:
If you no longer need the SSH key access, delete the key.
Set up your environment
-
Create a pair of public and private SSH keys for your SourceCraft account:
Linux/macOSWindows 10/11Windows 7/8-
Open the terminal.
-
Use the
ssh-keygen
command to create a new key:ssh-keygen -t ed25519 -C "<optional_comment>"
You can specify an empty string in the
-C
parameter to avoid adding a comment, or you may not specify the-C
parameter at all: in this case, a default comment will be added.After running this command, you will be prompted to specify the name and path to the key files, as well as enter the password for the private key. If you only specify the name, the key pair will be created in the current directory. The public key will be saved in a file with the
.pub
extension, while the private key, in a file without extension.By default, the command prompts you to save the key under the
id_ed25519
name in the following directory:/home/<username>/.ssh
. If there is already an SSH key namedid_ed25519
in this directory, you may accidentally overwrite it and lose access to the resources it is used in. Therefore, you may want to use unique names for all SSH keys.
If you do not have OpenSSH installed yet, follow this guide to install it.
-
Run
cmd.exe
orpowershell.exe
(make sure to update PowerShell before doing so). -
Use the
ssh-keygen
command to create a new key:ssh-keygen -t ed25519 -C "<optional_comment>"
You can specify an empty string in the
-C
parameter to avoid adding a comment, or you may not specify the-C
parameter at all: in this case, a default comment will be added.After running this command, you will be prompted to specify the name and path to the key files, as well as enter the password for the private key. If you only specify the name, the key pair will be created in the current directory. The public key will be saved in a file with the
.pub
extension, while the private key, in a file without extension.By default, the command prompts you to save the key under the
id_ed25519
name in the following folder:C:\Users\<username>/.ssh
. If there is already an SSH key namedid_ed25519
in this directory, you may accidentally overwrite it and lose access to the resources it is used in. Therefore, you may want to use unique names for all SSH keys.
Create keys using the PuTTY app:
-
Download and install PuTTY.
-
Add the folder with PuTTY to the
PATH
variable:- Click Start and type Change system environment variables in the Windows search bar.
- Click Environment Variables... at the bottom right.
- In the window that opens, find the
PATH
parameter and click Edit. - Add your folder path to the list.
- Click OK.
-
Launch the PuTTYgen app.
-
Select EdDSA as the pair type to generate. Click Generate and move the cursor in the field above it until key creation is complete.
-
In Key passphrase, enter a strong password. Enter it again in the field below.
-
Click Save private key and save the private key. Do not share its key phrase with anyone.
-
Click Save public key and save the public key to a file named
<key_name>.pub
.
-
-
Launch the SSH agent:
Linux/MacOSWindows-
Run this command:
ssh-agent -s
-
For the SSH agent to start on login, add the launch command to the
~/.profile
file:ssh-agent -s
- Open the Start button context menu.
- Select Computer Management.
- Go to Services and Applications → Services.
- Open the context menu of the SSH agent service and select Properties.
- On the Main tab, change the startup type from Off to Automatic.
- Click OK and start the service.
-
-
Add a key to the SSH agent:
ssh-add <private_key_path>
Add an SSH key to SourceCraft
- Open the service home page.
- In the left-hand panel, click
- Click
- In the window that opens:
- In the Key name field, specify a key name.
- In the Content field, paste the contents of the public SSH key file.
- Click Add.
You can add multiple SSH keys. To do so, click
Clone the repository
-
In the top-right corner of the repository page, click
-
Copy the
-
In the terminal, run this command:
git clone <link_for_cloning_repository>
-
Go to your cloned repository:
cd <repository_name>
Deleting an SSH key from SourceCraft
- Open the service home page.
- In the left-hand panel, click
- Click