The GitHub documentation says that this error is related to the Deploy key. Deploy key is an SSH key.
Due to the different users on the remote repository and on the local, you can establish a connection through the public key.
Therefore, you need not to dig into this file:
~/.gitconfig
More specifically, you need an SSH key that must be on your local machine and the same key must be added to the access keys of the desired remote repository.
The instructions below are for * nix machines.
First you need to check the existence of existing public keys. To check for the presence of a public SSH key, you need to register in the terminal:
ls -al ~/.ssh
By default, public key names are displayed as follows:
id_dsa.pub id_ecdsa.pub id_ed25519.pub id_rsa.pub
If there is no such key or for some reason you do not want to use existing ones, then you can generate a new public SSH key:
$ ssh-keygen -t rsa -b 4096 -C "ΡΠ²ΠΎΡ_ΠΏΠΎΡΡΠ°@ΠΏΠΎΡΡΠΎΠ²ΡΠΉ_ΠΏΠΎΠ΄Π΄ΠΎΠΌΠ΅Π½.Π΄ΠΎΠΌΠ΅Π½"
After the command above, a new SSH key will be created, which will be accompanied by mail as a label.
The following is displayed in the Terminal:
Generating public/private rsa key pair. Enter file in which to save the key (/Users/username/.ssh/id_rsa):
By pressing Enter, the key will be created in the default directory. Lines will appear below, where you will need to enter a password-phrase and repeat it.
Enter passphrase (empty for no passphrase): [ΠΠ°ΠΏΠΈΡΠΈ ΡΡΠ°Π·Ρ] Enter same passphrase again: [ΠΠ°ΠΏΠΈΡΠΈ ΡΡΠ°Π·Ρ]
After the generated key, you need to add this key to the SSH-agent. First you need to make sure that the SSH-agent is activated:
eval "$(ssh-agent -s)"
It should display something like the following:
Agent pid 39591
After that, it remains to add the SSH key to the SSH agent:
$ ssh-add ~/.ssh/id_rsa
Now, let's add the key to the access keys on the remote repository. First, add the SSH key to the clipboard:
$ pbcopy < ~/.ssh/id_rsa.pub
Do the following:
- Open GitHub in a browser and log in.
- Go to Settings
- Open the SSH and GPG keys section
- Push New SSH key
- Paste from the clipboard in the section Key data
- Fill the title
- Add the key and confirm the addition by entering the account password.
Profit. You should establish a connection between the local machine and the remote repository via an SSH key. The solution is based on information that GitHub tech support offers.