Existing SSH keys guide GitHub clone method choice and troubleshooting

Use the SSH clone URL as an alternative to HTTPS when you've previously configured SSH keys. Based on official documentation (checked 5 November 2026).

Route:
HTTPS
Repository-page selection:
HTTPS under Code
Documented scope:
Copy the HTTPS repository URL
Route:
SSH
Repository-page selection:
SSH under Code
Documented scope:
Clone using an SSH key, including an organization-issued SSH certificate
Route:
GitHub CLI
Repository-page selection:
GitHub CLI under Code
Documented scope:
Select GitHub's documented CLI cloning option

The SSH condition gives you a concrete choice without establishing that SSH is superior. I would base that choice on the keys you've already configured. Whichever route you choose, check permission to access the target repository; account authentication and repository permission are separate questions.

HTTPS, SSH and GitHub CLI cloning choices
Original documentation card showing GitHub's documented cloning choices. Source: GitHub cloning a repository, GitHub troubleshooting cloning errors, checked 5 Nov 2026

Copy from Code, or Quick setup for an empty repository

Copy the clone URL from Code on the repository page; use Quick setup for an empty repository's command-line HTTPS option. GitHub recommends copying and pasting the URL to avoid spelling errors.

  1. Navigate to the repository's main page on GitHub.
  2. Click Code and copy the HTTPS or SSH URL. For an empty repository's command-line HTTPS option, use Quick setup.
  3. Open Terminal.
  4. Change the current working directory to where you want the cloned directory.
  5. Type git clone, then paste the copied URL.
  6. Press Enter to create your local clone.

These are GitHub's documented instructions, not an executed result. Cloning pulls down the repository data GitHub has at that point in time, including all versions of every file and folder.

If you already have a local repository, git remote -v displays its configured remote URLs. It isn't a first-clone prerequisite or proof of repository access.

Repository not found leaves existence and permission unresolved

Repository not found means the repository doesn't exist or you don't have permission to access it. The message alone doesn't distinguish those causes. GitHub explicitly says that trying to clone a private repository without permission to view it produces this error.

Access relationship:
Owner
GitHub's private-repository permission condition:
You own the repository
Access relationship:
Collaborator
GitHub's private-repository permission condition:
You are a collaborator on the repository
Access relationship:
Organization team member
GitHub's private-repository permission condition:
Your team has access to the organization repository

Check the copied URL, repository existence and your access relationship before concluding that the repository was deleted. The relationships above come from GitHub's private-repository guidance; they aren't established as an exhaustive taxonomy for every repository.

For personal-account repositories, collaborators can read and write; they can't have read-only collaborator access. Removing a collaborator revokes that access, but they retain local clones. An old checkout therefore doesn't establish current permission.

Check prompted HTTPS credentials and the SSH greeting's account

For prompted HTTPS authentication, check the account and token conditions; for SSH, identify the personal account associated with your key. We recommend using the relevant checks below rather than treating a successful SSH greeting as repository permission.

  1. When HTTPS prompts for a username and password, use an account with access to the repository and a personal access token instead of the account password.
  2. If you're using a personal access token (classic) to access an organization that uses SAML SSO, authorize that token for the organization before authenticating.
  3. If you already use credential caching, check that the cached credentials are correct and current. Incorrect or outdated cached credentials cause authentication to fail.
  4. For SSH, use the documented check ssh -T git@github.com to check that the key is attached to your personal GitHub account.

GitHub's example greeting names USERNAME and reports successful authentication without shell access. That username identifies the authenticated account; it doesn't establish permission to clone your target repository. Compare the account with the repository's access relationships.

HTTPS credentials, SAML SSO and SSH account checks
Original documentation checklist separating authentication conditions from repository permission. Source: GitHub troubleshooting cloning errors, checked 5 Nov 2026

A deleted default branch requires administrator involvement

The error Remote HEAD refers to nonexistent ref, unable to checkout indicates that the repository's default branch has been deleted on GitHub.com. GitHub's documented repair requires repository administrator authority; involve an administrator if you don't have it.

Check branch existence separately from credentials. GitHub's general unable-to-clone guidance also asks you to check HTTPS connectivity and permission to access the repository.

Repository administrators can inspect the access list

If you administer the repository, you can inspect an overview of teams and people with access. This optional permission review is an administrator tool, separate from the clone user's account and cached-credential checks.

  1. Navigate to the repository's main page on GitHub.
  2. Click Settings under the repository name. If the tab isn't visible, select the dropdown menu and then Settings.
  3. In the sidebar's Access section, click Collaborators & teams.
  4. Under Manage access, start typing the team or person's name.

To see the source of conflicting access in that overview, hover over the warning icon or click Mixed roles.