chore: cleanup

This commit is contained in:
Bjarke Sporring
2026-01-16 12:15:11 +01:00
parent 968a44f9a5
commit cba2d9bb16
2 changed files with 28 additions and 42 deletions

View File

@@ -20,7 +20,7 @@ SSH (Secure Shell) keys provide a secure way to authenticate with Azure DevOps w
Before starting, ensure you have: Before starting, ensure you have:
- **Git 2.23 or higher** installed - **Git 2.23 or higher** installed
```powershell ```pwsh
git --version git --version
``` ```
@@ -28,7 +28,7 @@ Before starting, ensure you have:
- If you don't ask your organisation for an invitation - If you don't ask your organisation for an invitation
- **PowerShell 7+ or Bash terminal** for running commands - **PowerShell 7+ or Bash terminal** for running commands
```powershell ```pwsh
pwsh --version pwsh --version
``` ```
@@ -42,7 +42,7 @@ SSH authentication uses a key pair: a private key (stays on your computer) and a
Open your terminal and run: Open your terminal and run:
```powershell ```pwsh
ssh-keygen -t rsa ssh-keygen -t rsa
``` ```
@@ -73,7 +73,7 @@ Enter same passphrase again:
Check that your keys were created: Check that your keys were created:
**Windows PowerShell:** **Windows PowerShell:**
```powershell ```pwsh
dir $HOME\.ssh\ dir $HOME\.ssh\
``` ```
@@ -108,27 +108,17 @@ Now you'll upload your public key to Azure DevOps.
Open your terminal and display your public key: Open your terminal and display your public key:
**Linux/Mac:**
```bash
cat ~/.ssh/id_rsa.pub
```
**Windows PowerShell:** **Windows PowerShell:**
```powershell ```pwsh
type $HOME\.ssh\id_rsa.pub type $HOME\.ssh\id_rsa.pub
``` ```
**Windows Command Prompt:**
```cmd
type %USERPROFILE%\.ssh\id_rsa.pub
```
The output will look like this: The output will look like this:
``` ```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC2YbXnrSK5TTflZSwUv9KUedvI4p3JJ4dHgwp/SeJGqMNWnOMDbzQQzYT7E39w9Q8ItrdWsK4vRLGY2B1rQ+BpS6nn4KhTanMXLTaUFDlg6I1Yn5S3cTTe8dMAoa14j3CZfoSoRRgK8E+ktNb0o0nBMuZJlLkgEtPIz28fwU1vcHoSK7jFp5KL0pjf37RYZeHkbpI7hdCG2qHtdrC35gzdirYPJOekErF5VFRrLZaIRSSsX0V4XzwY2k1hxM037o/h6qcTLWfi5ugbyrdscL8BmhdGNH4Giwqd1k3MwSyiswRuAuclYv27oKnFVBRT+n649px4g3Vqa8dh014wM2HDjMGENIkHx0hcV9BWdfBfTSCJengmosGW+wQfmaNUo4WpAbwZD73ALNsoLg5Yl1tB6ZZ5mHwLRY3LG2BbQZMZRCELUyvbh8ZsRksNN/2zcS44RIQdObV8/4hcLse30+NQ7GRaMnJeAMRz4Rpzbb02y3w0wNQFp/evj1nN4WTz6l8= your@email.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC2YbXnrSK5TTflZSwUv9KUedvI4p3JJ4dHgwp/SeJGqMNWnOMDbzQQzYT7E39w9Q8ItrdWsK4vRLGY2B1rQ+BpS6nn4KhTanMXLTaUFDlg6I1Yn5S3cTTe8dMAoa14j3CZfoSoRRgK8E+ktNb0o0nBMuZJlLkgEtPIz28fwU1vcHoSK7jFp5KL0pjf37RYZeHkbpI7hdCG2qHtdrC35gzdirYPJOekErF5VFRrLZaIRSSsX0V4XzwY2k1hxM037o/h6qcTLWfi5ugbyrdscL8BmhdGNH4Giwqd1k3MwSyiswRuAuclYv27oKnFVBRT+n649px4g3Vqa8dh014wM2HDjMGENIkHx0hcV9BWdfBfTSCJengmosGW+wQfmaNUo4WpAbwZD73ALNsoLg5Yl1tB6ZZ5mHwLRY3LG2BbQZMZRCELUyvbh8ZsRksNN/2zcS44RIQdObV8/4hcLse30+NQ7GRaMnJeAMRz4Rpzbb02y3w0wNQFp/evj1nN4WTz6l8= your@email.com
``` ```
**Copy the entire output** (from `ssh-rsa` to your email address). **Copy the entire output** (from `ssh-rsa` to and including your email address).
### Paste and Name Your Key ### Paste and Name Your Key
@@ -152,12 +142,12 @@ Now that SSH is configured, you can use it for all Git operations.
To clone a repository using SSH: To clone a repository using SSH:
```bash ```pwsh
git clone git@ssh.dev.azure.com:v3/{organization}/{project}/{repository} git clone git@ssh.dev.azure.com:v3/{organization}/{project}/{repository}
``` ```
**Example** (replace placeholders with your actual values): **Example** (replace placeholders with your actual values):
```bash ```pwsh
git clone git@ssh.dev.azure.com:v3/myorg/git-workshop/great-print-project git clone git@ssh.dev.azure.com:v3/myorg/git-workshop/great-print-project
``` ```
@@ -175,7 +165,7 @@ git clone git@ssh.dev.azure.com:v3/myorg/git-workshop/great-print-project
All standard Git commands now work seamlessly with SSH: All standard Git commands now work seamlessly with SSH:
```bash ```pwsh
# Pull latest changes # Pull latest changes
git pull git pull
@@ -195,7 +185,6 @@ git push -u origin feature-branch
## Additional Resources ## Additional Resources
- **Azure DevOps SSH Documentation**: [https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate](https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate) - **Azure DevOps SSH Documentation**: [https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate](https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate)
- **SSH Key Best Practices**: [https://security.stackexchange.com/questions/tagged/ssh-keys](https://security.stackexchange.com/questions/tagged/ssh-keys)
- **Git with SSH**: [https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key](https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key) - **Git with SSH**: [https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key](https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key)
--- ---
@@ -204,17 +193,14 @@ git push -u origin feature-branch
### Common Commands ### Common Commands
```bash ```pwsh
# Generate RSA key # Generate RSA key
ssh-keygen -t ssh-keygen -t
# Display public key (Linux/Mac) # Display public key
cat ~/.ssh/id_rsa.pub
# Display public key (Windows)
type $HOME\.ssh\id_rsa.pub type $HOME\.ssh\id_rsa.pub
# Clone with SSH # Clone with SSH. You can find this url on Azure DevOps
git clone git@ssh.dev.azure.com:v3/{org}/{project}/{repo} git clone git@ssh.dev.azure.com:v3/{org}/{project}/{repo}
# Check remote URL # Check remote URL

View File

@@ -128,7 +128,8 @@ git pull
# Now we resolve the merge. We're merging the main branch INTO the feature-2 branch. # Now we resolve the merge. We're merging the main branch INTO the feature-2 branch.
git merge main git merge main
# Resolve the merge conflict in numbers.txt # Resolve the merge conflict in numbers.txt by opening in VSCode and choosing the changes you want.
# How you solve it is up to you.
# Once resolved # Once resolved
git add numbers.txt git add numbers.txt
git commit git commit
@@ -142,30 +143,29 @@ git pull
| Command | What It Does | | Command | What It Does |
|---------|--------------| |---------|--------------|
| `git switch -c <name>` | Create and switch to new branch | | `git switch -c <branch-name>` | Create and switch to new branch |
| `git push -u origin <branch>` | Push branch to Azure DevOps | | `git switch <branch-name>` | Switch to branch |
| `git switch main` | Switch to main branch | | `git push` | Push branch to Azure DevOps |
| `git pull` | Get latest changes from remote | | `git pull` | Get latest changes from remote |
--- ---
## Common Issues ## Cheatsheet
### "My PR has conflicts" ### Solving merge conflicts
1. Update your branch with latest main: ```pwsh
```powershell git switch main
git switch main git pull
git pull git switch <branch-name>
git switch <branch-name> git merge main
git merge main # ... Solve the conflicts
``` git push
2. Resolve conflicts in VS Code ```
3. Commit and push again
### "I need to make more changes to my PR" ### "I need to make more changes to my PR"
Just commit and push to the same branch - the PR updates automatically: Just commit and push to the same branch - the PR updates automatically:
```powershell ```pwsh
git add . git add .
git commit -m "fix: address review feedback" git commit -m "fix: address review feedback"
git push git push