Password: Permission Denied

Should the sudo control or elevated privileges exist used with Git?

You should not be using the sudo command or elevated privileges, such as administrator permissions, with Git. If you lot have a very adept reason you must use sudo, then ensure you are using it with every command (it's probably just better to apply su to get a shell as root at that point). If you generate SSH keys without sudo and then effort to use a command like sudo git push, you won't exist using the same keys that y'all generated.

Check that you are connecting to the correct server

Typing is hard, nosotros all know it. Pay attention to what you type; you won't be able to connect to "githib.com" or "guthub.com". In some cases, a corporate network may cause issues resolving the DNS record too.

To make sure you lot are connecting to the correct domain, you tin can enter the post-obit control:

          $ ssh -vT git@github.com > OpenSSH_8.1p1, LibreSSL ii.seven.three > debug1: Reading configuration data /Users/you/.ssh/config > debug1: Reading configuration information /etc/ssh/ssh_config > debug1: /etc/ssh/ssh_config line 47: Applying options for * > debug1: Connecting to github.com port 22.        

The connection should be made on port 22, unless you're overriding settings to apply SSH over HTTPS.

Always use the "git" user

All connections, including those for remote URLs, must be made as the "git" user. If you endeavor to connect with your GitHub username, information technology will fail:

          $ ssh -T            GITHUB-USERNAME@github.com > Permission denied (publickey).        

If your connection failed and you lot're using a remote URL with your GitHub username, you tin can modify the remote URL to apply the "git" user.

You lot should verify your connection by typing:

          $ ssh -T git@github.com > Hi            username! You've successfully authenticated...        

Make sure you have a key that is being used

  1. Open Final Terminal Git Bash.
  2. Verify that y'all have a individual key generated and loaded into SSH.
                    # starting time the ssh-agent in the groundwork $ eval "$(ssh-agent -s)" > Agent pid 59566 $ ssh-add together -fifty -East sha256 > 2048                  SHA256:274ffWxgaxq/tSINAykStUL7XWyRNcRTlcST1Ei7gBQ                  /Users/USERNAME/.ssh/id_rsa (RSA)              

If y'all have GitHub Desktop installed, you can use it to clone repositories and non deal with SSH keys.

  1. If yous are using Git Bash, turn on ssh-amanuensis:

                    # start the ssh-agent in the background $ eval "$(ssh-amanuensis -south)" > Amanuensis pid 59566              

    If yous are using some other terminal prompt, such as Git for Windows, turn on ssh-agent:

                    # start the ssh-agent in the background $ eval $(ssh-agent -southward) > Agent pid 59566              
  2. Verify that you have a private key generated and loaded into SSH.

                    $ ssh-add -fifty -E sha256 > 2048                  SHA256:274ffWxgaxq/tSINAykStUL7XWyRNcRTlcST1Ei7gBQ                  /Users/USERNAME/.ssh/id_rsa (RSA)              
  1. Open up Terminal Terminal Git Bash.
  2. Verify that you have a private key generated and loaded into SSH.
                    $ ssh-add -fifty -East sha256 > 2048                  SHA256:274ffWxgaxq/tSINAykStUL7XWyRNcRTlcST1Ei7gBQ                  /Users/USERNAME/.ssh/id_rsa (RSA)              

The ssh-add command should print out a long string of numbers and letters. If information technology does not print anything, you will need to generate a new SSH key and associate it with GitHub.

Tip: On most systems the default private keys (~/.ssh/id_rsa and ~/.ssh/identity) are automatically added to the SSH hallmark agent. You lot shouldn't need to run ssh-add path/to/primal unless you override the file proper name when you generate a key.

Getting more details

You can as well check that the key is being used by trying to connect to git@github.com:

          $ ssh -vT git@github.com > ... > debug1: identity file /Users/y'all/.ssh/id_rsa type -1 > debug1: identity file /Users/y'all/.ssh/id_rsa-cert type -1 > debug1: identity file /Users/you/.ssh/id_dsa type -i > debug1: identity file /Users/you/.ssh/id_dsa-cert type -1 > ... > debug1: Authentications that can continue: publickey > debug1: Adjacent hallmark method: publickey > debug1: Trying private fundamental: /Users/you/.ssh/id_rsa > debug1: Trying individual key: /Users/y'all/.ssh/id_dsa > debug1: No more authentication methods to try. > Permission denied (publickey).        

In that example, we did not have any keys for SSH to apply. The "-1" at the end of the "identity file" lines means SSH couldn't find a file to utilise. Afterwards, the "Trying private key" lines also indicate that no file was found. If a file existed, those lines would exist "1" and "Offering public key", respectively:

          $ ssh -vT git@github.com > ... > debug1: identity file /Users/you/.ssh/id_rsa blazon 1 > ... > debug1: Authentications that tin continue: publickey > debug1: Adjacent authentication method: publickey > debug1: Offer RSA public fundamental: /Users/y'all/.ssh/id_rsa        

Verify the public key is attached to your account

You must provide your public key to GitHub to establish a secure connection.

  1. Open Concluding.

  2. Start SSH agent in the background.

                    $ eval "$(ssh-agent -southward)" > Amanuensis pid 59566              
  3. Discover and take a annotation of your public key fingerprint.

                    $ ssh-add -l -Eastward sha256 > 2048                  SHA256:274ffWxgaxq/tSINAykStUL7XWyRNcRTlcST1Ei7gBQ                  /Users/USERNAME/.ssh/id_rsa (RSA)              
  4. In the upper-right corner of any folio, click your profile photo, so click Settings.

    Settings icon in the user bar

  5. In the "Access" section of the sidebar, click SSH and GPG keys.

  6. Compare the listing of SSH keys with the output from the ssh-add control. SSH key listing in GitHub

  1. Open up the control line.

  2. Commencement SSH agent in the background.

                    $ ssh-agent -southward > Agent pid 59566              
  3. Discover and take a annotation of your public central fingerprint.

                    $ ssh-add -l -East sha256 > 2048                  SHA256:274ffWxgaxq/tSINAykStUL7XWyRNcRTlcST1Ei7gBQ                  /Users/USERNAME/.ssh/id_rsa (RSA)              
  4. In the upper-right corner of any page, click your profile photo, then click Settings.

    Settings icon in the user bar

  5. In the "Access" section of the sidebar, click SSH and GPG keys.

  6. Compare the list of SSH keys with the output from the ssh-add command. SSH key listing in GitHub

  1. Open up Terminal.

  2. Showtime SSH amanuensis in the background.

                    $ eval "$(ssh-agent -s)" > Amanuensis pid 59566              
  3. Find and take a note of your public key fingerprint. If yous're using OpenSSH half-dozen.7 or older:

                    $ ssh-add -50 > 2048                  a0:dd:42:3c:5a:9d:e4:2a:21:52:4e:78:07:6e:c8:4d                  /Users/USERNAME/.ssh/id_rsa (RSA)              

    If y'all're using OpenSSH 6.eight or newer:

                    $ ssh-add -fifty -E md5 > 2048                  MD5:a0:dd:42:3c:5a:9d:e4:2a:21:52:4e:78:07:6e:c8:4d                  /Users/USERNAME/.ssh/id_rsa (RSA)              
  4. In the upper-correct corner of any page, click your profile photo, then click Settings.

    Settings icon in the user bar

  5. In the "Access" section of the sidebar, click SSH and GPG keys.

  6. Compare the listing of SSH keys with the output from the ssh-add command. SSH key listing in GitHub

If you don't run across your public key in GitHub, you'll need to add your SSH primal to GitHub to associate it with your computer.

Alarm: If you meet an SSH cardinal you're not familiar with on GitHub, delete it immediately and contact GitHub Support, for further help. An unidentified public key may indicate a possible security business. For more than information, see "Reviewing your SSH keys."

gustafsonpereadesen.blogspot.com

Source: https://docs.github.com/en/authentication/troubleshooting-ssh/error-permission-denied-publickey

0 Response to "Password: Permission Denied"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel