Permission Denied Please Try Again. Ssh Mac

Should the sudo command or elevated privileges be used with Git?

Y'all should non be using the sudo command or elevated privileges, such as administrator permissions, with Git. If y'all take a very good reason you must use sudo, then ensure you are using information technology with every command (it'south probably just ameliorate to use su to get a shell as root at that point). If y'all generate SSH keys without sudo and so try to apply a command similar sudo git push, you won't exist using the same keys that you generated.

Check that you are connecting to the correct server

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

To make sure y'all are connecting to the correct domain, you can enter the post-obit command:

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

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

E'er use the "git" user

All connections, including those for remote URLs, must be made as the "git" user. If you effort to connect with your GitHub username, it will neglect:

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

If your connection failed and you're using a remote URL with your GitHub username, you can change the remote URL to use the "git" user.

Yous should verify your connection by typing:

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

Make sure y'all take a key that is being used

  1. Open Concluding Terminal Git Bash.
  2. Verify that you take a individual central generated and loaded into SSH.
                    # start the ssh-agent in the groundwork $ eval "$(ssh-agent -s)" > Agent pid 59566 $ ssh-add together -l -E sha256 > 2048                  SHA256:274ffWxgaxq/tSINAykStUL7XWyRNcRTlcST1Ei7gBQ                  /Users/USERNAME/.ssh/id_rsa (RSA)              

If you have GitHub Desktop installed, you can use it to clone repositories and not deal with SSH keys.

  1. If you are using Git Bash, plough on ssh-amanuensis:

                    # beginning the ssh-agent in the background $ eval "$(ssh-agent -s)" > Amanuensis pid 59566              

    If y'all are using another terminal prompt, such as Git for Windows, turn on ssh-agent:

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

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

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

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

Getting more details

You can also check that the key is beingness used past trying to connect to git@github.com:

          $ ssh -vT git@github.com > ... > debug1: identity file /Users/you/.ssh/id_rsa type -one > debug1: identity file /Users/you lot/.ssh/id_rsa-cert type -1 > debug1: identity file /Users/you/.ssh/id_dsa blazon -1 > debug1: identity file /Users/you/.ssh/id_dsa-cert blazon -ane > ... > debug1: Authentications that can go on: publickey > debug1: Side by side authentication method: publickey > debug1: Trying private key: /Users/you/.ssh/id_rsa > debug1: Trying private key: /Users/y'all/.ssh/id_dsa > debug1: No more hallmark methods to try. > Permission denied (publickey).        

In that example, we did not have any keys for SSH to employ. The "-one" at the end of the "identity file" lines means SSH couldn't find a file to use. Later on, the "Trying individual key" lines besides indicate that no file was found. If a file existed, those lines would be "i" and "Offering public cardinal", respectively:

          $ ssh -vT git@github.com > ... > debug1: identity file /Users/yous/.ssh/id_rsa blazon i > ... > debug1: Authentications that can go on: publickey > debug1: Next hallmark method: publickey > debug1: Offering RSA public central: /Users/you/.ssh/id_rsa        

Verify the public key is attached to your account

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

  1. Open Terminal.

  2. Start SSH amanuensis in the background.

                    $ eval "$(ssh-agent -s)" > Agent pid 59566              
  3. Notice and take a note of your public key fingerprint.

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

    Settings icon in the user bar

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

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

  1. Open the command line.

  2. Start SSH amanuensis in the groundwork.

                    $ ssh-amanuensis -south > Agent pid 59566              
  3. Find and take a note of your public fundamental fingerprint.

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

    Settings icon in the user bar

  5. In the "Admission" 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 Terminal.

  2. Start SSH agent in the background.

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

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

    If you're using OpenSSH vi.8 or newer:

                    $ ssh-add -l -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 contour photograph, and 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 list 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 demand to add together your SSH key to GitHub to associate it with your computer.

Warning: If yous run into an SSH fundamental you're not familiar with on GitHub, delete it immediately and contact GitHub Support, for further help. An unidentified public cardinal may signal a possible security concern. For more data, run across "Reviewing your SSH keys."

myersdecorichiggy.blogspot.com

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

0 Response to "Permission Denied Please Try Again. Ssh Mac"

Postar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel