Permission denied publickey keyboard interactive windows

Error: Permission denied (publickey)

A «Permission denied» error means that the server rejected your connection. There could be several reasons why, and the most common examples are explained below.

In this article

Should the sudo command be used with Git?

Check that you are connecting to the correct server

Typing is hard, we 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 as well.

To make sure you are connecting to the right domain, you can enter the following command:

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

Always use the «git» user

All connections, including those for remote URLs, must be made as the «git» user. If you try to connect with your GitHub username, it will fail:

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.

You should verify your connection by typing:

Make sure you have a key that is being used

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

If you are using Git Bash, turn on ssh-agent:

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

Verify that you have a private key generated and loaded into SSH.

The ssh-add command should print out a long string of numbers and letters. If it 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/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 you generate a key.

Getting more details

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

In that example, we did not have any keys for SSH to use. The «-1» at the end of the «identity file» lines means SSH couldn’t find a file to use. Later on, the «Trying private key» lines also indicate that no file was found. If a file existed, those lines would be «1» and «Offering public key», respectively:

Verify the public key is attached to your account

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

Start SSH agent in the background.

Find and take a note of your public key fingerprint.

In the upper-right corner of any page, click your profile photo, then click Settings.

In the user settings sidebar, click SSH and GPG keys.

Compare the list of SSH keys with the output from the ssh-add command.

Open the command line.

Start SSH agent in the background.

Find and take a note of your public key fingerprint.

In the upper-right corner of any page, click your profile photo, then click Settings.

In the user settings sidebar, click SSH and GPG keys.

Compare the list of SSH keys with the output from the ssh-add command.

Start SSH agent in the background.

Find and take a note of your public key fingerprint. If you’re using OpenSSH 6.7 or older:

If you’re using OpenSSH 6.8 or newer:

In the upper-right corner of any page, click your profile photo, then click Settings.

In the user settings sidebar, click SSH and GPG keys.

Compare the list of SSH keys with the output from the ssh-add command.

If you don’t see your public key in GitHub, you’ll need to add your SSH key to GitHub to associate it with your computer.

Читайте также:  Kmsauto не запускается под windows 10

Warning: If you see an SSH key you’re not familiar with on GitHub, delete it immediately and contact GitHub Support or GitHub Premium Support, for further help. An unidentified public key may indicate a possible security concern. For more information, see «Reviewing your SSH keys.»

Help us make these docs great!

All GitHub docs are open source. See something that’s wrong or unclear? Submit a pull request.

Источник

permission denied (publickey) Error using git on windows 7

When I want to push to github with this command

15 Answers 15

EUREKA!

Apparently, you can use plink as the main ssh client and just load your keys in pageant (if you’re like me, you already do):

You can do that by setting the GIT_SSH env variable to plink.exe path like so:

set GIT_SSH=C:\Program Files\PuTTY\plink.exe

or, you can use plink from TortoiseGit:

set GIT_SSH=c:\Program Files\TortoiseGit\bin\TortoisePLink.exe

Credit: Original solution taken from this blog post

I was able to resolve this issue as follows:

it prompts you to (optionally) enter a filename for saving the generated keys. Specifying a filename wasted my whole day! Next day I let it use the default filename and the problem(s) disappeared! Imagine!!

Platform was Win7 and msysgit.

Here is a step-by-step guide that I used to get this to work.

Platform: Windows 7

During installation, accept all of the default options, except when the ‘Select Components’ option appears. When this appears, select ‘Git Bash Here’ option. Although this isn’t necessary, it adds a nice context menu when working in Windows Explorer that I found to be very helpful.

Once msysgit is installed Git Bash will also be installed. Open Git Bash in one of 2 ways:

In Git Bash’s command window, enter this:

When asked to enter a file name, just accept the default. Choose a strong passphrase when prompted, and your public key should now be saved. Your screen should look like this:

Go open the public key file in Notepad. The file should reside here:

Copy all of the content in the file to your clipboard, then go to GitHub’s SSH settings page:

Choose ‘Add SSH key’, enter a useful ‘Title’ and paste the content into the ‘Key’ textarea.

To simplify your life, you can use the SSH agent to save your passphrase so that you don’t need to remember it. To do so, type this into Git Bash:

You’ll be prompted to enter your passsphrase. If everything succeeds, your identity will have been added. Note: this passphrase will be forgotten as soon as you close your shell. I’m not sure how to make this persist across sessions, but maybe someone can help?

To test that everything works, enter this into Git Bash:

Источник

How to solve Permission denied (publickey) error when using Git?

but that gives me this error:

What am I missing?
I’ve also tried doing ssh-keygen with no passphase but still same error.

46 Answers 46

If the user has not generated a ssh public/private key pair set before

This info is working on theChaw but can be applied to all other git repositories which support SSH pubkey authentications. (See gitolite, gitlab or github for example.)

First start by setting up your own public/private key pair set. This can use either DSA or RSA, so basically any key you setup will work. On most systems you can use ssh-keygen.

That’s it you should be good to clone and checkout.

If the user has generated a ssh public/private key pair set before

More extensive troubleshooting and even automated fixing can be done with:

This error can happen when you are accessing the SSH URL (Read/Write) instead of Git Read-Only URL but you have no write access to that repo.

Sometimes you just want to clone your own repo, e.g. deploy to a server. In this case you actually only need READ-ONLY access. But since that’s your own repo, GitHub may display SSH URL if that’s your preference. In this situation, if your remote host’s public key is not in your GitHub SSH Keys, your access will be denied, which is expected to happen.

An equivalent case is when you try cloning someone else’s repo to which you have no write access with SSH URL.

Читайте также:  Ftp client cmd windows

In a word, if your intent is to clone-only a repo, use HTTPS URL ( https://github.com//.git ) instead of SSH URL ( git@github.com:/.git ), which avoids (unnecessary) public key validation.

Update: GitHub is displaying HTTPS as the default protocol now and this move can probably reduce possible misuse of SSH URLs.

The github help link helped me sort out this problem. Looks like the ssh key was not added to the ssh-agent. This is what I ended up doing.

Ensure ssh-agent is enabled. The command starts the ssh-agent in the background:

Add your SSH key to the ssh-agent:

Got same error report.

Fixed with using HTTP instead. Since I don’t want set «SSH keys» for a test PC.

Change URL to HTTP when clone:

My problem is a little bit different: I have URL set when adding a existing local repo to remote, by using:

To fix it, reset URL to HTTP:

BTW, you may check your URL using command:

Hope this will help some one like me. 😀

I was struggling with same problem that’s what i did and i was able clone the repo. I followed these procedure for iMac.

First Step : Checking if we already have the public SSH key.

/.ssh to see if existing SSH keys are present:

Check the directory listing to see if you already have a public SSH key.Default public are one of the following d_dsa.pub,id_ecdsa.pub,id_ed25519.pub,id_rsa.pub

If you don’t find then go to step 2 otherwise follow step 3

Step 2 : Generating public SSH key

This will generate id_rsa.pub

Step 3: Adding your SSH key to the ssh-agent

Now copy the SSH key and also add it to you github account

Источник

Permission denied (publickey,password,keyboard-interactive)

I cannot login into ssh due to the following error:

storage> ssh localhost
Permission denied (publickey,password,keyboard-interactive).

my sshd configuration:

# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.

Port 22
Protocol 2,1
#AddressFamily any
ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

#now ssh is only used by rsync ==> auth by passwd file of rsync server
#AuthPassFile /etc/rsyncd.secrets

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Change to yes if you don’t trust

/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don’t read the user’s

/.shosts files
IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to ‘yes’ to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# «PermitRootLogin without-password». If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
#UsePAM no
Compression yes

#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server

I tried to remove /root/.ssh/known_hosts
and regenerate all keys:

Источник

Getting permission denied (public key) on gitlab

My problem is that I can’t push or fetch from GitLab. However, I can clone (via HTTP or via SSH). I get this error when I try to push :

Permission denied (publickey) fatal : Could not read from remote repository

From all the threads I’ve looked, here is what I have done :

If you have any insight about how to resolve my issue, it would be greatly appreciated.

/.ssh/id_rsa – rivanov Jun 21 ’17 at 20:18

/.ssh/the_key» followed by authorising they key by phrase. This is the private part of what I added to GitLab. – Celdor Sep 24 ’19 at 12:23

Читайте также:  Windows 10 не открывается звук

37 Answers 37

I found this after searching a lot. It will work perfectly fine for me.

Now give it a shot and it will work for sure.

Step 1: Added a config file in

/.ssh/config file which looks like

I think the simple solution is to add private key to authentication agent (if your key is not

You basically let the ssh-agent take care of it.

In my case it did not work in the WSL (Windows Subsystem for Linux).

When I start the WSL, I must

if it return nothing, try this:

it must create identity in

it must return your identity, so after retry to clone, it’s must work

NB: don’t forget to add your ssh key in your profile gitlab

In my case, it wasn’t a gitlab problem, but a sshd configuration one. The ssh server didn’t allow connection except for a list of users. The user git, the one connecting remotely to gitlab, wasn’t in that list. So, check this before anything else.

I have gitlab running with docker, this is what I did to fix my problem.

Found that inside docker /var/log/gitlab/sshd/current there were multiple occurences of a message:

Authentication refused: bad ownership or modes for file /var/opt/gitlab/.ssh/authorized_keys

After which I changed ownership of that file from 99:users to git:users with:

Steps to be done, got same error but i fixed it. Gitlab wants ssh-rsa so below is the code to run ssh for rsa

name@gmail.com is your gitlab account email

It will prompt you to enter so just hit Enter after the below code is prompt,

Enter file in which to save the key (/home/yourDesktopName/.ssh/id_rsa):

It will prompt again you to enter so just hit Enter after the below code is prompt,

Enter passphrase (empty for no passphrase):

It will prompt again for the last you to enter so just hit Enter after the below code is prompt,

Enter same passphrase again:

You will show your ssh-rsa generate.

Login to your Gitlab account and Go to the right navbar you will get setting and in the left sidebar you will get ssh key. Enter in it.

Look above the prompt asking you to enter, you will get the path of ssh-rsa.

Go to your SSH folder and get the id_rsa.pub

Open it and get the key and Copy Paste to the Gitlab and you are nearly to done.

You will get: Welcome to GitLab, @joy4!

I know, I’m answering this very late and even StackOverflow confirmed if I really want to answer. I’m answering because no one actually described the actual problem so wanted to share the same.

The Basics

The Protocols

Basically, Git clone/push/pull works on two different protocols majorly (there are others as well)-

When you clone a repo (or change the remote URL) and use the HTTPs URL like https://gitlab.com/wizpanda/backend-app.git then it uses the first protocol i.e. HTTP protocol.

While if you clone the repo (or change the remote URL) and uses the URL like git@gitlab.com:wizpanda/backend-app.git then it uses the SSH protocol.

HTTP Protocol

In this protocol, every remote operation i.e. clone, push & pull uses the simple authentication i.e. username & password of your remote (GitLab in this case) that means for every operation, you have to type-in your username & password which might be cumbersome.

So when you push/pull/clone, GitLab/GitHub authenticate you with your username & password and it allows you to do the operation.

To avoid that case, you can use the SSH protocol.

SSH Protocol

A simple SSH connection works on public-private key pairs. So in your case, GitLab can’t authenticate you because you are using SSH URL to communicate. Now, GitLab must know you in some way. For that, you have to create a public-private key-pair and give the public key to GitLab.

Now when you push/pull/clone with GitLab, GIT (SSH internally) will by default offer your private key to GitLab and confirms your identity and then GitLab will allow you to perform the operation.

So I won’t repeat the steps which are already given by Muhammad, I’ll repeat them theoretically.

General thought

Both the approach have their pros & cons. After I typed the above text, I went to search more about this because I never read something about this.

Источник

Поделиться с друзьями
Советы экспертов и специалистов
Adblock
detector