<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.planetoid.info/index.php?action=history&amp;feed=atom&amp;title=Troubleshooting_of_GIT</id>
	<title>Troubleshooting of GIT - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.planetoid.info/index.php?action=history&amp;feed=atom&amp;title=Troubleshooting_of_GIT"/>
	<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Troubleshooting_of_GIT&amp;action=history"/>
	<updated>2026-06-05T00:48:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.planetoid.info/index.php?title=Troubleshooting_of_GIT&amp;diff=26348&amp;oldid=prev</id>
		<title>Planetoid: Created page with &quot; == Troubleshooting of GIT ==  === Restoring deleted files in Git === Restoring deleted files in Git  === SSH Authentication Failed: Permission denied (publickey) ===  &#039;&#039;&#039;Error Message&#039;&#039;&#039;  After keyin the command &lt;pre&gt;git clone git@github.com:your-org/your-repo.git /opt/your-app&lt;/pre&gt;, met the error message  &lt;pre&gt; Cloning into &#039;/opt/your-app&#039;... git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.  Please make sure you have the...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Troubleshooting_of_GIT&amp;diff=26348&amp;oldid=prev"/>
		<updated>2026-06-04T06:39:32Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; == Troubleshooting of GIT ==  === Restoring deleted files in Git === &lt;a href=&quot;/index.php/Restoring_deleted_files_in_Git&quot; title=&quot;Restoring deleted files in Git&quot;&gt;Restoring deleted files in Git&lt;/a&gt;  === SSH Authentication Failed: Permission denied (publickey) ===  &amp;#039;&amp;#039;&amp;#039;Error Message&amp;#039;&amp;#039;&amp;#039;  After keyin the command &amp;lt;pre&amp;gt;git clone git@github.com:your-org/your-repo.git /opt/your-app&amp;lt;/pre&amp;gt;, met the error message  &amp;lt;pre&amp;gt; Cloning into &amp;#039;/opt/your-app&amp;#039;... git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.  Please make sure you have the...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
== Troubleshooting of GIT ==&lt;br /&gt;
&lt;br /&gt;
=== Restoring deleted files in Git ===&lt;br /&gt;
[[Restoring deleted files in Git]]&lt;br /&gt;
&lt;br /&gt;
=== SSH Authentication Failed: Permission denied (publickey) ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Error Message&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
After keyin the command &amp;lt;pre&amp;gt;git clone git@github.com:your-org/your-repo.git /opt/your-app&amp;lt;/pre&amp;gt;, met the error message&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Cloning into &amp;#039;/opt/your-app&amp;#039;...&lt;br /&gt;
git@github.com: Permission denied (publickey).&lt;br /&gt;
fatal: Could not read from remote repository.&lt;br /&gt;
&lt;br /&gt;
Please make sure you have the correct access rights and the repository exists.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Cause&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This error occurs when Git cannot authenticate with GitHub over SSH. This typically means the SSH key on your machine is either missing, not registered with your GitHub account, or not being picked up by the SSH agent.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Solutions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Option 1 — Configure your SSH config file&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Add an entry to `~/.ssh/config` so Git automatically uses the correct key:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host github.com&lt;br /&gt;
  HostName github.com&lt;br /&gt;
  User git&lt;br /&gt;
  IdentityFile /path/to/.ssh/your_key_name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Option 2 — Pass the SSH key inline&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
1. Before running `git clone`, test whether the specified SSH key can successfully authenticate with GitHub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh -T -i /path/to/.ssh/your_key_name git@github.com&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the key is configured correctly, you should see:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Hi your-org/your-app! You&amp;#039;ve successfully authenticated, but GitHub does not provide shell access.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
`successfully authenticated` confirms the key is correctly linked to your GitHub account and you&amp;#039;re good to proceed with `git clone`. The message `GitHub does not provide shell access` is expected — SSH is used for Git operations only, not for interactive shell login.&lt;br /&gt;
&lt;br /&gt;
2. Override the SSH command directly when cloning:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo GIT_SSH_COMMAND=&amp;#039;ssh -i /path/to/.ssh/your_key_name -o IdentitiesOnly=yes&amp;#039; \&lt;br /&gt;
  git clone git@github.com:your-org/your-repo.git /opt/your-app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{exclaim}} Notice: `-o IdentitiesOnly=yes` prevents SSH from trying other keys loaded in the agent, which can cause unexpected auth failures.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
&lt;br /&gt;
* [https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent Generating a new SSH key and adding it to the ssh-agent - GitHub Docs]&lt;br /&gt;
* [https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account Adding a new SSH key to your GitHub account - GitHub Docs]&lt;br /&gt;
* [https://docs.github.com/en/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection Testing your SSH connection - GitHub Docs]&lt;br /&gt;
* [https://linux.die.net/man/5/ssh_config ssh_config(5): OpenSSH SSH client config files - Linux man page]&lt;br /&gt;
* [https://docs.github.com/en/authentication/troubleshooting-ssh Troubleshooting SSH - GitHub Docs]&lt;br /&gt;
&lt;br /&gt;
[[Category: Git]]&lt;br /&gt;
[[Category: Revised with LLMs]]&lt;/div&gt;</summary>
		<author><name>Planetoid</name></author>
	</entry>
</feed>