Error Prompt "Permission Denied" without any other context probably means you've to give Git Bash/Github Desktop administrator rights.
xxxxxxxxxx
https://happygitwithr.com/img/2019-01-git-windows-administrator.png
xxxxxxxxxx
git config user.name "new name"
git config credential.username "new name"
xxxxxxxxxx
If you encounter the following error while trying to clone a repository:
```
Cloning into 'repo name'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
```
You can resolve the issue by following these steps:
1. **Start the SSH Agent:**
In your terminal, execute the following command to start the SSH agent, which manages your SSH keys:
$ eval "$(ssh-agent -s)"
This command initializes the SSH agent and sets up the necessary environment variables.
2. **Add Your GitHub SSH Key:**
Use the following command to add your GitHub SSH private key (`github_rsa` in this example) to the SSH agent:
$ ssh-add ~/.ssh/github_rsa
Replace `github_rsa` with the name of your private SSH key file. If you used the default name, it might be `id_rsa`.
The SSH agent now holds your key securely, enabling smooth authentication.
3. **List Added Keys:**
To verify that your key has been successfully added to the SSH agent, run:
$ ssh-add -l
This command will display a list of all the keys currently managed by the SSH agent.
4. **Check SSH_AUTH_SOCK:**
Confirm that the `SSH_AUTH_SOCK` environment variable is correctly set by typing:
$ echo $SSH_AUTH_SOCK
The displayed output should indicate the location of the SSH agent's Unix socket.
By completing these steps, you will have resolved the permission denied error and allowed your SSH key to authenticate with the remote repository, facilitating successful cloning.