Permission denied publickey windows git

Как устранить ошибку Permission denied (publickey) при использовании Git?

Я думаю, вы найдете, что единственный надежный способ сделать это — использовать массив, а не ассоциативный массив, например:

7 ответов

Это работает для меня:

В моем случае я переустановил Ubuntu, и имя пользователя изменилось с предыдущего. В этом случае сгенерированный ключ ssh также отличается от предыдущего.

Проблема решена путем простого копирования текущего открытого ключа ssh в хранилище. Ключ будет доступен у вашего пользователя /home/.ssh/id_rsa.pub

Да, если вы используете git, просто следуйте документации. Theres чертовски много Документации, написанной на этом. Вы не можете пойти не так, если вы будете следовать этому. Просто начните сначала, если вам нужно. Ссылка: https://help.github.com/articles/connecting-to-github-with-ssh/

Я только что столкнулся с этой проблемой при настройке моего текущего проекта, и ни одно из вышеуказанных решений не работает поэтому я попытался посмотреть, что на самом деле происходит в списке отладки, используя команду ssh -vT git@github.com. Я заметил, что моего закрытого ключа с именем файла нет в списке. поэтому переименовав имя файла с закрытым ключом в id_rsa, сделайте свою работу. надеюсь, это поможет.

Получено то же сообщение об ошибке.

Исправлено использование HTTP вместо. Так как я не хочу устанавливать «ключи SSH» для тестового ПК.

Измените URL-адрес на HTTP при клонировании:

Моя проблема немного отличается : у меня установлен URL-адрес при добавлении существующего локального репо на удаленный компьютер с помощью:

Чтобы исправить это, сбросьте URL-адрес на HTTP:

Кстати, вы можете проверить свой URL-адрес с помощью команды:

Надеюсь, это поможет некоторым такой как я : D [1 110]

Это довольно прямо. Введите следующую команду

Сгенерируйте ключ SSH. Откройте файл и скопируйте содержимое. Перейдите на страницу настроек GitHub и нажмите на ключ SSH. Нажмите Добавить новый ключ SSH и вставьте содержимое здесь. Вот и все 🙂 Вы не должны видеть проблему снова.

Эта ошибка может возникать, когда вы обращаетесь к URL-адресу SSH (чтение / запись) вместо URL-адреса Git только для чтения, но у вас нет прав на запись в этот репозиторий.

Иногда вы просто хотите клонировать свое собственное репо, например, развернуть на сервере. В этом случае вам нужен только доступ только для чтения. Но поскольку это ваше собственное репо , GitHub может отображать URL SSH, если вы предпочитаете это. В этой ситуации, если открытый ключ вашего удаленного хоста отсутствует в ваших SSH-ключах GitHub, вашему доступу будет отказано, , что ожидается .

Читайте также:  Симс 4 со всеми дополнениями для mac os

Эквивалентным случаем является случай, когда вы пытаетесь клонировать чужое хранилище, к которому у вас нет прав записи с помощью SSH URL.

Одним словом, , если вы хотите клонировать репо, используйте HTTPS URL ( https://github.com//.git ) вместо SSH URL ( git@github.com:/.git ), что позволяет избежать (ненужной) проверки открытого ключа .

Обновление: GitHub теперь отображает HTTPS в качестве протокола по умолчанию, и этот шаг, вероятно, может уменьшить возможное неправильное использование URL-адресов SSH.

Ошибка: Permission denied (доступ запрещен) /публичный ключ/

Ошибка «Permission denied» (доступ запрещён) означает, что сервер отклонил ваше соединение. У этой ошибки может быть несколько причин; наиболее общие из них приведены ниже.

Можно ли использовать в Git команду sudo ?

Вы не должны использовать команду sudo с Git. Если у вас есть веская причина использовать sudo , убедитесь, что вы используете её с каждой командой (возможо, лучше использовать su чтобы получить оболочку с правами суперпользователя (администратора) в этом месте). Если вы сгенерировали SSH-ключ без sudo , а затем пытаетесь использовать команду, подобную sudo git push , вы не должны использовать те же ключи, которые сгенерировали.

Проверьте, что вы подключились к нужному серверу

Будьте внимательны при вводе команд с клавиатуры. В некоторых случаях корпоративная сеть может привести к проблемам разрешения записи DNS.

Так как документ подготовлен в рамках курсов повышения квалификации «Правильный курс» , то и проверка подключения будет описана именно на этом примере.
Напомним, что доступ к репозиторию [email protected] организован по порту 25000, а не по стандартному для SSH порту 22. Поэтому в команде подключения вы должны явно указать номер порта.

Для того, чтобы убедиться в том, что вы подключаетесь к нужному домену, введите следующую команду, добавив в строке номер порта ‘-p 2500’ :

Всегда использовать пользователя «git»

Все соединения длджны выполняться под пользователем «git». Если вы попытаетесь соединиться под вашим псевдонимом в propercourse, соединение не установится:

Вместо этого вы должны проверить соединение, набрав в строке:

Убедитесь, что у вас есть ключ, который используется

Если вы используете Git Bash, включите ssh-agent:

Если вы используете другой командный процессор, такой как, например, Git для Windows, включите ssh-agent:

Проверьте, что у вас есть сгенерированный и загруженный в SSH приватный ключ.
Если вы используете OpenSSH 6.7 или более ранний:

Если вы используете OpenSSH 6.8 или более позднюю:

Команда ssh-add должна вывести длинную строку из цифр и букв. Если ничего не будет выведено на экран, вы должны сгенерировать новый SSH-ключ и связать его с GitLab.

Замечание. В большинстве систем приватные ключи по умолчанию (

/.ssh/identity ) автоматически добавляются к агенту аутентификации SSH. Вы не должны запускать ssh-add path/to/key , иначе вы перезапишите имя файла при генерации ключа.

Получение детализации

Вы можете также проверить, что ключ используется при попытках соединения с [email protected] :

Git: Permission denied (publickey). #42039

Comments

George35mk commented Jan 23, 2018

From the command line is work perfect
The problem is when I use vscode interface

  • VSCode Version: latest
  • OS Version: Windows 10

Steps to Reproduce:

  1. when I try to push the code or create new branch I get this message

Does this issue occur when all extensions are disabled?: Yes/No
yes

The text was updated successfully, but these errors were encountered:

George35mk commented Jan 23, 2018 •

I have remote server on 192.168.2.3

In the commad line I can push the code but if I click the button I get a popup with this error

inside the .ssh I have a folder with this config

please dont close this issue I cannot find exampple solution with Windows 10 vscode

George35mk commented Jan 23, 2018

There is any way to configure the RSA key before vscode push the code to prevent this error

joaomoreno commented Jan 24, 2018

Are you using Git for Windows? What is the full location of that SSH config file?

George35mk commented Jan 24, 2018

the rsa keys are in C:\Users\George35mk\.ssh folder

there i have this files

My work gitlab projects is on remote server and I want to connect with ssh

if I connect with git bash I can create a new branch but I can’t do the same with VSCODE gui
The VScode don’t communicate with this repository

This work is creating new branch on the server on 192.168.2.3

But when I do the same thing with the VScode like this I get this error popup

George35mk commented Jan 24, 2018 •

basically, I can’t do anything with vscode on this type of repository

This is the output logs

George35mk commented Jan 24, 2018

The VScode don’t even ask me for ssh keys, nothing if this is the problem

joaomoreno commented Jan 24, 2018

You’re actually making different operations in both examples. In the command line you are simply creating a branch. In VS Code, you’re creating it and trying to push it to the remote. The branch was successfully created. the status bar actually reports the correct branch name.

Can you run git push from a normal Command Prompt?

George35mk commented Jan 24, 2018

ok give me a sec

George35mk commented Jan 24, 2018

if I run on power shell this command I get this message
Everything up-to-date

George35mk commented Jan 24, 2018

Joao Moreno, Now I work with git bash and I have created the branch on the remote the problem is I have lost all the interactive features that VScode provide with git integrations I can commit the change with VScode but I cannot pull, Push or to see the changes. I see all the time this icon on the bottom and does not disappear even when I have created and publish the branch.

George35mk commented Jan 24, 2018

In gitbash when I create or commit new changes or push. is askme for the password

If the vscode can do the same is gonna work

George35mk commented Jan 24, 2018

Or If is possible to set a workspace in VScode and set a password for the ssh key for this project

George35mk commented Jan 24, 2018

I want to say that when I run git status I get this

George35mk commented Jan 24, 2018 •

OMG Finally I find the solution to this freakin Error

  • Step 1 in your project folder run start-ssh-agent
  • Step 2 add your id_rsa or whatever name of your private RSA key password
  • Step 3 in the same directory open the cmd or power shell and run code

stoberov commented Feb 26, 2018

A VSCode user since the very beginning here.

The same thing (permission denied error) started happening to me since the last Windows update we got at the office

Indeed, one solution is to run start-ssh-agent inside the Integrated Terminal, but it has to be done every time. Another solution is to run the VSCode instance with administrator privileges — still a bit annoying.

@joaomoreno , I wonder if there is some edge case that VSCode does not cover for?

George35mk commented Feb 26, 2018 •

Yes, bro, I get the same error again after the new windows 10 update.
I solve this problem in the past by using the https version and nor the ssh I solve this problem but again in new update the not even the https let me push I pc is complicated I have gihub, bitbucket and gitLab I try the solution you propose with the administration rights.

Thanks, Best George35mk.

stoberov commented Feb 26, 2018 •

Thanks for a quick reply! In those 5 minutes, I too noticed that the issue was present with projects where the git origin was set to git@git. git . Other projects that are using origin https://git. do not experience the issue.

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

I´m having trouble with GitHub. I´ve playing around with a remote repository of Git.

When I now try to make any changes to the remote directory, i.e.

I get this error

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

Please make sure you have the correct access rights and the repository exists. Ulrichs-MacBook-Pro:coredatatest ulrichheinelt$ git push -u origin master Permission denied (publickey). fatal: Could not read from remote repository.

I would be happy, when I could start again with a new (empty) remote directory. Or is there a way, to fix this error?

This are my first steps with GitHub, started yesterday. Many thanks in advance!

Edit 1

Edit 2

too early happy 🙁

After setting the SSH and GPG keys, the errors are still the same. :-/

Edit 3

I think that’s right so, but still the same.

10 Answers 10

  • On your GitHub profile there is an Edit Profile button.
    It is located on top-right corner of the webpage.
  • Press it and you will see left Personal Settings menu.
  • Inside that menu find SSH and GPG keys option and press it.
  • You will see an option New SSH key to add new key.

  1. Generate SSH key using ssh-keygen -t rsa -b 4096 -C «your email» .
  2. Copy the output of cat

/.ssh/id_rsa.pub to your clipboard

  • Paste the above copied output to the form at https://github.com/settings/ssh/new
  • generate your key

    Visualize your keys

    Start the agent

    Add your key to the agent

    I was having the same problem with my ssh connection. I tried to work it through ssh, but couldn’t find a working solution for it. So, in that case, I changed my remote URL from SSH to HTTPS. I used the command: $ git remote set-url origin https://github.com/USERNAME/REPOSITORY.git . You can see your remote url changed using: $ git remote -v .

    You can find more detail on Here

    This will change your remote URL to HTTPS so you will now have to type your GitHub username and password to push your project to the remote repo. I know ssh is easier than HTTPS meaning that you don’t have to type out your username and password, but this might be helpful if you didn’t find any solution for fixing it through ssh, and you are in a rush to push your code to your repo.

    Читайте также:  Linux дистрибутив собственная сборка
    Оцените статью