Introduction

When moving from Ubuntu to Windows 11, one of the first challenges a developer may encounter is configuring Git and GitHub to work with SSH authentication.

On Ubuntu, I was already familiar with using the terminal to manage Git repositories, generate SSH keys, and authenticate with GitHub. However, Windows introduced a few differences, particularly when working with Command Prompt (CMD), PowerShell, and the Windows OpenSSH Authentication Agent.

This article documents some of the challenges I encountered during the transition and explains how to configure GitHub SSH authentication on Windows 11 using CMD.

The goal is to help beginners understand not just which commands to execute, but also why they are necessary.

1. Understanding Git and SSH Authentication

Before configuring anything, it is important to understand the relationship between Git, GitHub, and SSH.

  • Git: A version control system used to track changes in source code.
  • GitHub: A cloud-based platform for hosting Git repositories and collaborating with other developers.
  • SSH: A secure communication protocol that allows your computer to authenticate with remote services such as GitHub without repeatedly entering your password.

SSH authentication uses a key pair:

  1. A private key stored securely on your computer.
  2. A public key added to your GitHub account.

GitHub uses the public key to verify that your computer possesses the corresponding private key.

Important: Never share your private SSH key. Only the public key should be added to GitHub.

2. Installing and Verifying Git on Windows

The first step is to ensure Git is installed.

Open Command Prompt and execute:

git --version 

If Git is installed correctly, the command displays its installed version.

If Windows does not recognise the command, download and install Git for Windows:

https://git-scm.com/downloads/win

After installation, close and reopen CMD before checking again.

3. Configuring Git Identity

Git needs to know the name and email address associated with your commits.

On Ubuntu, the commands are the same as on Windows:

git config --global user.name "Your Name" git config --global user.email "your-email@example.com" 

To verify the configuration:

git config --global --list 

This configuration identifies the author of your commits. It does not authenticate you with GitHub.

That distinction is important: Git identity and GitHub authentication are two different things.

4. Understanding the Windows Terminal Environment

One challenge when moving from Ubuntu to Windows is that terminal commands are not always interchangeable.

For example:

Task Ubuntu Windows CMD
List files ls -la dir /a
Show current directory pwd cd
Display file contents cat file.txt type file.txt
Copy a file cp old new copy old new
Move a file mv old new move old new
Delete a file rm file.txt del file.txt
Clear terminal clear cls

Understanding these differences helps prevent errors when following Linux-based tutorials on Windows.

5. Understanding the SSH Agent on Windows

On Ubuntu, developers commonly start an SSH agent using:

eval "$(ssh-agent -s)" 

Windows handles this differently through a background service called ssh-agent.

The service manages private keys that SSH can use for authentication.

Step 1: Open CMD as Administrator

Some service-management operations require administrative privileges.

To open an elevated Command Prompt:

  1. Open the Windows Start menu.
  2. Search for cmd.
  3. Right-click Command Prompt.
  4. Select Run as administrator.

Step 2: Configure the SSH Agent

Execute the following command:

sc.exe config ssh-agent start= auto 

This configures the SSH Agent service to start automatically when Windows starts.

Notice the space after start=. It is required by the sc.exe command.

Step 3: Start the Service

Execute this separately:

net start ssh-agent 

To check its status:

sc.exe query ssh-agent 

Look for:

STATE : 4 RUNNING 

This indicates that the service is running.

A challenge I encountered: Access is denied

When attempting to configure the service, Windows returned an access-denied error.

The issue was not necessarily with Git or SSH. The Command Prompt was not running with sufficient administrative privileges.

The solution was to reopen CMD as Administrator and execute the service commands again.

Lesson: Some Windows commands require elevated privileges. Always distinguish between ordinary CMD and Administrator CMD.

6. Understanding the Difference Between CMD and PowerShell

Another important lesson is that CMD and PowerShell are different command-line environments.

For example, this PowerShell command:

Set-Service -Name ssh-agent -StartupType Automatic 

is not a CMD command.

Running it directly in CMD will produce an error.

Similarly, combining commands without a separator can cause unexpected errors.

For example:

Set-Service -Name ssh-agent -StartupType AutomaticStart-Service ssh-agent 

This is incorrect because Windows interprets the combined text as part of the command.

Instead, execute one command at a time.

In CMD, the following commands can be used:

sc.exe config ssh-agent start= auto 

Then:

net start ssh-agent 

Understanding which terminal you are using makes troubleshooting much easier.

7. Checking Whether an SSH Key Is Already Loaded

Before generating a new SSH key, check whether one is already loaded in the SSH agent.

Execute:

ssh-add -l 

This lists the SSH identities currently available to the agent.

A successful result may look similar to:

256 SHA256:EXAMPLE_FINGERPRINT example@example.com (ED25519) 

The fingerprint is an identifier for the key, not the private key itself.

If an identity appears, it means an SSH key is loaded in the agent.

However, this does not automatically mean that the public key has been registered with GitHub.

Display the loaded public key

One useful command is:

ssh-add -L 

This displays the public keys currently loaded in the SSH agent.

It is particularly helpful when you do not know the original filename or location of your SSH key.

Remember that the output of ssh-add -L contains public key material, not private key material.

8. Finding SSH Keys on Windows

Windows OpenSSH normally stores SSH keys in:

C:\Users\YOUR_USERNAME\.ssh 

To inspect this directory from CMD, execute:

dir /a "%USERPROFILE%\.ssh" 

A typical directory may contain:

id_ed25519 id_ed25519.pub known_hosts 

The files have different purposes:

File Purpose
id_ed25519 Private SSH key
id_ed25519.pub Public SSH key
known_hosts Records trusted SSH servers

Do not upload or share the private key.

If your key has a different filename, do not assume that id_ed25519.pub exists. Use ssh-add -L to inspect the public key already loaded in the agent.

9. Adding the Public Key to GitHub

After identifying the correct public key, the next step is to register it with GitHub.

You can open the public-key output using:

ssh-add -L 

Alternatively, if you know the exact public-key file location:

type "%USERPROFILE%\.ssh\id_ed25519.pub" 

To copy that file's contents to the clipboard:

clip < "%USERPROFILE%\.ssh\id_ed25519.pub" 

Only use the file command if that file actually exists.

GitHub configuration

  1. Log in to GitHub.
  2. Open Settings.
  3. Select SSH and GPG keys.
  4. Click New SSH key.
  5. Enter a descriptive title, such as Windows 11 Laptop.
  6. Select Authentication Key.
  7. Paste the public key.
  8. Save the key.

If GitHub reports that the key already exists, it may already be registered to an account. You do not need to generate another key just because you encountered that message.

GitHub documentation:

https://docs.github.com/en/authentication/connecting-to-github-with-ssh

10. Testing the SSH Connection

After registering the public key, test the connection from CMD:

ssh -T git@github.com 

On the first connection, SSH may ask whether you trust GitHub's host identity.

Review the host information and, if it matches GitHub's published SSH host fingerprints, type:

yes 

A successful authentication produces a message similar to:

Hi USERNAME! You've successfully authenticated, but GitHub does not provide shell access. 

This is not an error.

It means GitHub has successfully authenticated your SSH key. GitHub does not provide an interactive shell through this connection.

What if authentication fails?

If you receive:

Permission denied (publickey). 

Check the following:

  1. Is the SSH Agent service running?
  2. Does ssh-add -l show a loaded key?
  3. Does ssh-add -L display the expected public key?
  4. Is that public key registered with the correct GitHub account?
  5. Are you connecting using the correct GitHub SSH address?

Avoid generating another key immediately. First identify the source of the authentication problem.

11. Cloning GitHub Repositories Using SSH

Once SSH authentication works, you can clone repositories without repeatedly entering GitHub credentials.

The general command is:

git clone git@github.com:USERNAME/REPOSITORY.git 

Replace USERNAME and REPOSITORY with the appropriate GitHub account and repository names.

For an existing project, inspect its remote URL:

git remote -v 

If it uses HTTPS and you want to switch to SSH, execute:

git remote set-url origin git@github.com:USERNAME/REPOSITORY.git 

You can then verify the change:

git remote -v 

12. Important Lessons from the Transition

Moving from Ubuntu to Windows taught me several practical lessons:

1. Do not assume Linux commands work in CMD.

Although both environments support Git and SSH, their command-line tools and service-management approaches differ.

2. Understand administrative permissions.

Windows protects system services. Some operations require an elevated terminal.

3. Execute commands separately.

Combining commands accidentally can result in confusing errors. Beginners should execute and verify each command before proceeding.

4. Check for existing SSH keys before generating new ones.

Running ssh-add -l helps determine whether a key is already loaded. Generating unnecessary keys can create additional confusion.

5. Understand the difference between public and private keys.

The public key belongs in GitHub. The private key must remain securely stored on your computer.

6. Successful Git configuration does not mean successful GitHub authentication.

Configuring user.name and user.email identifies commit authorship. SSH authentication establishes a trusted connection with GitHub.

Conclusion

Configuring GitHub SSH authentication on Windows 11 is straightforward once you understand how Windows handles SSH services and how its command-line environment differs from Ubuntu.

The most important lesson is to understand what each command does rather than copying commands from tutorials without considering the operating system.

For developers transitioning between Linux and Windows, learning these differences builds confidence and makes everyday development tasks easier.

Whether you are using Django, Laravel, Spring Boot, React, or another technology, a properly configured Git environment is an important part of your development workflow.

Next step: Explore the official Git documentation and GitHub SSH authentication guide to deepen your understanding.