IT story

GitHub : 권한이 거부되었습니다 (공개 키).

hot-time 2020. 5. 10. 10:24
반응형

GitHub : 권한이 거부되었습니다 (공개 키). 치명적인 : 원격 끝이 예기치 않게 끊어졌습니다.


아래 지침에 따라 프로젝트를 업로드했습니다.

전역 설정 :

 Download and install Git
  git config --global user.name "Your Name"
  git config --global user.email tirenga@gmail.com
  Add your public key


Next steps:

  mkdir tirengarfio
  cd tirengarfio
  git init
  touch README
  git add README
  git commit -m 'first commit'
  git remote add origin git@github.com:tirenga/tirenga.git
  git push origin master

하지만이 오류가 발생합니다.

권한이 거부되었습니다 (공개 키). 치명적인 : 원격 끝이 예기치 않게 끊어졌습니다.


나에게 문제는 sudo를 통한 복제 실행이었습니다.

사용자 권한이있는 디렉토리 (/ home / user / git)에 복제하면 제대로 작동합니다.

(설명 : 수퍼 유저로 명령을 실행하면 사용자와 명령을 실행하는 것과 동일한 공개 키를 사용할 수 없으므로 Github가 연결을 거부했습니다.)

이 솔루션을 사용하려면 SSH 키가 이미 설정되어 있어야합니다. https://help.github.com/articles/generating-ssh-keys


공개 키를 github에 추가해야했습니다. https://help.github.com/articles/generating-ssh-keys


예, 공개 키 문제입니다. 저는 Windows 사용자이며 아래 페이지에서이 문제를 해결하는 데 도움이됩니다.

http://help.github.com/win-set-up-git/

보다 정확하게이 링크는 도움이 될 것입니다

https://help.github.com/articles/error-permission-denied-publickey


RSA 키 페어를 생성 한 후에는 다음을 사용하여 SSH에 추가해야합니다.

ssh-add ~/.ssh/id_rsa

또는 어디에서 rsa 키 페어를 만들 었는지.


사용자 이름 및 저장소 이름을 사용하여 다음 명령을 입력하십시오.

git clone https://github.com/{user name}/{repo name}

우분투에서 이것은 완벽하게 작동합니다.


튜토리얼에서 오랜 시간 후에 해결책을 얻었습니다.

이 링크-> https://help.github.com/articles/error-permission-denied-publickey 에서 github 튜토리얼을 따라 모든 단계에서 연결할 수있었습니다. 그러나 push -u origin mastergit 하려고 할 때이 오류가 발생했습니다.

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

Please make sure you have the correct access rights

Thats how I`ve fixed it!! Go to the project directory using the Terminal and check it out

$git remote -v

You will get something like this:

origin  ssh://git@github.com/yourGithubUserName/yourRepo.git (fetch)
origin  ssh://git@github.com/yourGithubUserName/yourRepo.git (push)

If you are using anything different then git@github.com, open the config file on git directory by typing the command:

vi .git/config

And configure the line

[remote "origin"]

url = ssh://git@github.com/yourGithubUserName/yourRepo.git

fetch = +refs/heads/*:refs/remotes/origin/

In my case, I had to setup the public key for another user, as I already had one for my main user. once I switched users and performed the commands in the link above I was able to perform the setup for my test server without a problem.


I had this problem, but none of the solutions above worked. I could clone and fetch but couldn't push. Eventually, I figured out the problem was in the url in my .git/config, it should be:

git@github.com:<username>/<project>

(not ssh://github.com/<username>/<project>.git or https://github.com/<username>/<project>.git).


Given that none of the answers here worked for me, I finally tracked down my issue connecting to Bitbucket (or Github, doesn't matter in this case) with ssh -vT git@bitbucket.org.

In my case, the failure was due to using a DSA key instead of RSA, and apparently my SSH client no longer allows that.

debug1: Skipping ssh-dss key /c/Users/USER/.ssh/id_dsa for not in PubkeyAcceptedKeyTypes

The solution was to add this to .ssh/config:

Host *
    PubkeyAcceptedKeyTypes +ssh-dss

This elegantly appends the ssh-dss key type to all existing accepted public key types and after this was done, git can now ssh into Bitbucket no problem.


My issue was that I was trying to give my ssh key a SPECIFIC NAME every time I entered ssh-keygen on my mac terminal.

I solved the issue by just leaving the name that "ssh-keygen" generates = id_rsa. You'll end up with 2 keys in your .ssh folder on a mac, id_rsa, which is your private key, and the id_rsa.pub, which is your public key. Then I copied and saved the code from id_rsa.pub into my GitHub account settings, and that was it. Problem solved.


A good one if you have installed git on your computer:

http://help.github.com/mac-set-up-git/


Adding public key is the solution.For generating ssh keys: https://help.github.com/articles/generating-ssh-keys has step by step instructions.

However, the problem can persist if key is not generated in the correct way. I found this to be a useful link too: https://help.github.com/articles/error-permission-denied-publickey

In my case the problem was that I was generating the ssh-key without using sudo but when using git commands I needed to use sudo. This comment in the above link "If you generate SSH keys without sudo, then when you try to use a command like sudo git push, you won't be using the SSH key you generated." helped me.

So, the solution was that I had to use sudo with both key generating commands and git commands. Or for others, when they don't need sudo anywhere, do not use it in any of the two steps. (key generating and git commands).


I faced a similar issue when running SSH or Git Clone in Windows. Following findings helps to solve my problem:

  • When you run “rhc setup” or other ssh methods to generate ssh key, it will create the private key file id_rsa in .ssh folder in your home folder, default is C:\User\UserID
  • Git for windows has its own .ssh folder in its installation directory. When you run git/ssh, it will look for private key file id_rsa in this folder
  • Solved the problem by copying id_rsa from the home folder .ssh folder to the .ssh folder in the git installation directory

Also, I think there a way to “tell” git to use the default .ssh folder in home folder but still need to figure out how.


For me, it worked like this:

In GitHub I changed the ssh link to https, and then gave the following commands:

$ git init
$ git remote add origin https:...
$ git add .
$ git commit -m "first commit"
$ git push origin master

Use ubuntu on windows store

windows subsystem for linux

, your git push will work across different accounts.


If you are using a linux machine then check,

  • do you have Openssh installed
  • if you do, then do you have an existing public key otherwise you'll have to generate one.
  • is your public key added to your github account.

Generating new SSH keys and adding them to my Github account solved my problem. You can look into this page for more details. GitHelp.


You can try change your type connection to branch from ssh to https.

  1. nano project_path/.git/config
  2. Replace git@github.com:username/repository.git to https://username@github.com/username/repository_name.git
  3. Save file ctrl + o

After that you can try git pull without publickey


You need to set up SSH keys.

This GitHub page explains how to generate keys.

If you have an existing key, you copy $HOME/.ssh/id_rsa.pub and paste it into the GitHub SSH settings page.


A quick way to fix this if you're using a Mac is to sign out of the OSX app and log back in.


My problem was that it didn't work with a passphrase on my private key.

Hope that helps someone.


I also have this problem today. The solution is setting your "ssh key". Click the url below, follow the steps, then you will sovle it.

http://github.com/guides/providing-your-ssh-key


I tried the solutions mentioned but still failed. I found the solution that finally worked for me here - removing then re-adding the remote link


I had the same issue on windows. I switched from SSH to HTTPS and ran a Git PUSH.

git push -u origin master
Username for 'https://github.com': <Github login email>
Password for <Github login>: xxx

Successful! hope this helps.

참고URL : https://stackoverflow.com/questions/3617113/github-permission-denied-publickey-fatal-the-remote-end-hung-up-unexpectedl

반응형