Clone Git Via SSH (From Azure To Ubuntu)


May 21, 2025

Overview


  • Demonstrate How to clone Git repository from Azure to Ubuntu using SSH step by step.

Precondition


I use...

  • Ubuntu 24.04 on WSL
  • Git repository on Azure DevOps
  • git version 2.43.0

Steps


Generate an SSH key (if you don’t have one)

  • You don't need to install OpenSSH server for cloning Git repository, we just need SSH client that usually pre-installed.
# Ensure your SSH client is available.
$ ssh -V
ssh -V
OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2

# Generate an SSH key
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/[user]/.ssh/id_rsa): 
Created directory '/home/[user]/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again:

The key fingerprint is:
SHA256:(fingerprint) "your_email@example.com"
The key's randomart image is:
+---[RSA 4096]----+
|+o.oO..oo...     |
| ...             |
|OOo+++.          |
+----[SHA256]-----+

Add your public key to Azure DevOps

  • Get you public key
$ cat ~/.ssh/id_rsa.pub
ssh-rsa *****== your_email@example.com

Paste On Azure DevOps

  • Go to Azure DevOps → User Settings → SSH Public Keys
  • Click "+ New Key" button
  • Name it & Paste the public key in "Public Key Data" column
  • Add
  • Ensure the SSH key pops is added and the Status is Active

Copy The SSH url On Azure DevOps

  • Go to Azure DevOps → Your Project → Repos
  • Click "Clone" button on right-up side
  • Select "SSH" on Command line column
  • Copy it

Clone It

  • Head to the directory you want to place the Git repository.
# For initiated publish, input "yes" when the dialog asking you for continue connecting.

$ git clone git@ssh.dev.azure.com:v3/your_organization/your_project/your_repo
Cloning into '${git dir}'...
The authenticity of host 'ssh.dev.azure.com (20.195.68.24)' can't be established.
RSA key fingerprint is SHA256:${fingerprint}.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'ssh.dev.azure.com' (RSA) to the list of known hosts.
remote: Azure Repos
remote: Found 13771 objects to send. (113 ms)
Receiving objects: 100% (13771/13771), 150.28 MiB | 6.49 MiB/s, done.
Resolving deltas: 100% (7954/7954), done.
  • Now you can see the Git repo exists in your directory.
  • Don't forget to enter it.
#Git #ssh #ubuntu #wsl #azure






你可能感興趣的文章

React(12) - useCallback & useMemo & memo

React(12) - useCallback & useMemo & memo

SQL & NoSQL

SQL & NoSQL

基礎 PHP & MySQL 資料庫

基礎 PHP & MySQL 資料庫






留言討論






2
2
2