SSH Setup and Usage Guide with Git
This guide will walk you through setting up and using SSH keys with Git to securely connect to remote repositories on AIOZ AI.
Prerequisites
- Git installed on your system
- Access to a terminal or command prompt
1. Checking for Existing SSH Keys
Before generating a new SSH key, check if you already have existing keys on your system.
On Linux / macOS / Windows (Git Bash)
ls -al ~/.sshLook for files with these common names:
id_rsaandid_rsa.pub(RSA keys)id_ecdsaandid_ecdsa.pub(ECDSA keys)id_ed25519andid_ed25519.pub(Ed25519 keys)
If you see files ending in .pub, these are your public keys. If you have
existing keys and want to use them, you can skip to the
Adding SSH Key to Your Account section.
On Windows (Command Prompt / PowerShell)
dir %USERPROFILE%\.ssh2. Generating a New SSH Key
If you don't have existing SSH keys or want to create a new one, follow these steps
Command: Replace [email protected] with your actual email address.
This email is used as a comment to help identify your key.
ssh-keygen -t ed25519 -C "[email protected]"Note: Ed25519 keys are more secure and performant than RSA keys. But if your system doesn't support Ed25519, use RSA with a minimum 4096-bit length:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
Step-by-Step Process
Step 1: Enter the command
ssh-keygen -t ed25519 -C "[email protected]"Step 2: Choose file location
> Generating public/private ed25519 key pair.
> Enter file in which to save the key (/home/username/.ssh/id_ed25519):Options:
- Press
Enterto use the default location (/home/username/.ssh/id_ed25519) - Or specify a custom path:
/home/username/.ssh/id_ed25519_github - Or specify a custom filename:
/home/username/.ssh/my_custom_key
Step 3: Enter passphrase
> Enter passphrase (empty for no passphrase):Options:
- Press
Enterfor no passphrase (less secure but more convenient) - Enter a strong passphrase (recommended for security)
Step 4: Confirm passphrase
Re-enter the same passphrase as above
> Enter same passphrase again:Step 5: Key generation complete
Example result:
Your identification has been saved in /home/username/.ssh/id_ed25519
Your public key has been saved in /home/username/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:abc123def456ghi789jkl012mno345pqr678stu901vwx234yzA [email protected]
The key's randomart image is:
+--[ED25519 256]--+
| .o. |
| . .+ |
| . . o. |
| . o =.. |
| . o S * |
| . + = X o |
| + * O = |
| . = B = . |
| . *.= E |
+----[SHA256]-----+Understanding the Output
The command generates two files:
- Private key:
~/.ssh/id_ed25519- Keep this secret! - Public key:
~/.ssh/id_ed25519.pub- This is what you share
Key components explained:
- Fingerprint: A unique identifier for your key
- Randomart: A visual representation of your key for easy identification
- Email: The comment you added with
-Cflag (helps identify the key's purpose)
Important: Never share your private key. Only share the public key (.pub
file).
3. Adding SSH Key to SSH Agent (Linux / macOS)
The SSH agent manages your SSH keys and remembers your passphrase so you don't have to enter it repeatedly.
Start the SSH Agent
eval "$(ssh-agent -s)"Add Your SSH Key to the Agent
ssh-add ~/.ssh/id_ed25519If you set a passphrase, you'll be prompted to enter it.
4. Adding SSH Key to Your Account
You need to add your public key to your account on AIOZ AI.
Copy Your Public Key
Linux / macOS / Windows (Git Bash):
cat ~/.ssh/id_ed25519.pubWindows (Command Prompt / PowerShell):
type %USERPROFILE%\.ssh\id_ed25519.pubCopy the entire output, including the ssh-ed25519 prefix and your email
address.
Add to your account on AIOZ AI
- Sign in at aiozai.network (opens in a new tab).
- Open the menu (☰) and go to your Profile by clicking your avatar.
Or, select "My Profile" in left navigation panel. - Click the "Settings" button.
- In the sidebar, select "SSH Keys".
- Click "Add new SSH key".
- Enter a descriptive title.
- Paste your public key into the "Key" field.
- Click "Add SSH Key" to save.
5. Testing SSH Connection
Test your SSH connection to verify everything is set up correctly.
ssh -T [email protected]Expected response:
> Hi username! You've successfully authenticated, but AIOZ AI Git does not provide shell access.6. Using SSH with Git
Once SSH is set up, you can clone repositories using SSH URLs from AIOZ AI.
Clone a Repository
git clone [email protected]:<username>/<repository-name>.gitChange Existing Repository to Use SSH with AIOZ AI
If you have an existing repository, change it to SSH:
# Check current remote URL
git remote -v
# Change to SSH URL
git remote set-url origin [email protected]:<username>/<repository-name>.git
# Verify the change
git remote -vTroubleshooting
Permission Denied Error
- Ensure your SSH key is added to the SSH agent
- Verify the public key is correctly added to your account
- Check that you're using the correct SSH URL for cloning
SSH Agent Not Running
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519Testing with Verbose Output
Add -v flag for detailed debugging information:
ssh -vT [email protected]Key Permissions (Linux / macOS)
Ensure proper permissions on SSH files:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
chmod 644 ~/.ssh/id_ed25519.pubSecurity Best Practices
- Use a passphrase for your SSH keys
- Keep private keys secure - never share or commit them
- Use Ed25519 keys when possible for better security
- Regularly rotate keys - consider generating new keys periodically
- Remove unused keys from your accounts
- Use different keys for different purposes (work/personal)
Summary
You've now learned how to:
- Check for existing SSH keys
- Generate new SSH keys
- Add keys to your SSH agent
- Add public keys to your account
- Test SSH connections
- Use SSH URLs with Git commands