development

Heroku '허가 거부 (공개 키) 치명적 : 원격 저장소에서 읽을 수 없음'문제

big-blog 2020. 6. 22. 07:20
반응형

Heroku '허가 거부 (공개 키) 치명적 : 원격 저장소에서 읽을 수 없음'문제


나는 해결하기 쉬운 것처럼 보이는 문제에 대한 해결책을 찾기 위해 여러 시간 동안 주위를 둘러 보았습니다. 내 검색이 아무 것도 설정 한 것이 아니라 내 검색이 너무 많은 다른 솔루션을 찾은 것입니다.

어쨌든 내 Mac의 Heroku 저장소에서 밀거나 당기거나 가져올 수 없습니다. 모든 시도는 나를 조롱하는 것처럼 다음과 같은 오류를 발생시킵니다.

'권한이 거부되었습니다 (공개 키). 치명적 : 원격 저장소에서 읽을 수 없습니다. '

여러 가지 방법으로 문제를 해결하려고 시도했습니다. 내가 말했듯이, 나는 지난 이틀 동안 좋은 답을 보냈다. 내가 시도한 것들 중 일부는 다음과 같습니다.

  • heroku 키 : 클리어 다음에 heroku 키 : add
  • 'ssh-keygen -t rsa'를 사용하여 자체적으로 ssh 키 재생성
  • 내 .ssh 디렉토리를 지우고 heroku 키 : clear, ssh 키 생성
  • heroku에서 내 앱을 삭제하고 다시 만드는 중 (다행히 많지는 않았지만)

내 GitHub 리포지토리에서 가져올 수 있으므로 네트워크 연결이 아님을 알고 있습니다 (ping heroku도 작동합니다).

임시 솔루션 (영구 솔루션으로 변하지 않기를 희망)으로 Ubuntu Amazon AWS ec2 인스턴스에 로그인했습니다. Heroku로 당기고 밀면 완벽하게 작동합니다. 이런 이유로 여전히 문제는 Mac의 ssh 키에있는 것처럼 느껴집니다. 두 키 모두 Heroku 계정에 나타납니다. 키 끝에있는 이메일 주소가 중요합니까?

편집 : GitHub에서 밀고 당길 수 있습니다 (그러나 ssh를 사용하지 않습니다). 왜 Heroku는 사용하지 않습니까?

이 시점에서 나는 무엇이든 시도하려고한다. 감사!


나는 이것이 이미 답변되었음을 알고 있습니다. 그러나 앞으로 다른 사람들에게 도움이 될 수 있으므로 솔루션을 추가하고 싶습니다.

일반적인 키 오류는 다음과 같습니다 Permission denied (publickey).. keys:addHeroku에 새 키를 알리기 위해이 문제를 해결할 수 있습니다 .

간단히 말하면 다음 단계를 따르십시오. https://devcenter.heroku.com/articles/keys

먼저 키가 없으면 키를 만들어야합니다.

ssh-keygen -t rsa

두 번째로 Heroku에 키를 추가해야합니다.

heroku keys:add

나는 내 자신의 질문에 대한 답을 찾은 것을 나눌 것이라고 생각했습니다.

내 문제를 적어 보면 더 명확 해졌고 문제가 어디에 있다고 생각하는지 더 자세히 조사했습니다 .ssh 키

내가 옳았다. 문제는 키 자체가 아니라 로컬 Mac의 알려진 ssh 키 목록에 추가하지 않았기 때문입니다. 따라서 내 Heroku 계정에 올바른 키가 업로드 되었더라도 내 컴퓨터에서 해당 키를 찾을 수 없기 때문에 Mac에서 인증 할 수 없습니다. 해결책?

ssh-add ~/.ssh/id_rsa
#and, to confirm it's been added to the known list of keys
ssh-add -l

나는에 신용주고 싶습니다 https://help.github.com/articles/error-permission-denied-publickey을 좋은 참조 것에 대해.


나는 정확히 같은 오류가 있었으며 (Windows 7에서) 원인이 다릅니다. 다른 방법으로 해결 했으므로 다른 사람들을 위해 여기에 원인과 해결책을 추가 할 것이라고 생각했습니다.

오류가 heroku를 가리키는 것처럼 보이지만 실제로 오류가 말하고 "Heroku can't get to the git repository"있습니다. 나는 모든 서버에서 동일한 키를 가지고 있다고 맹세했습니다. 왜냐하면 나는 그것을 만들고 동시에 하나씩 업로드했기 때문입니다.

이것에 거의 하루를 보낸 후 나는 자식이 실제 키가 아니라 지문 만 보여주기 때문에 깨달았습니다. 키가 HD 또는 heroku의 키와 일치하는지 확인할 수 없습니다. 나는 알려진 호스트 파일을보고 무엇을 추측합니다 ... 각 서버의 키를 보여 주며 git 및 heroku 공개 키가 일치하지 않는다는 것을 분명히 알 수있었습니다.

1) 키 폴더의 모든 파일, 웹 사이트를 사용하는 github의 키, git bash 및 명령을 사용하는 heroku의 키를 모두 삭제했습니다. heroku keys:clear

2) 여기github의 지침에 따라 새 키 페어를 생성하고 공개 키를 git에 업로드하십시오.

3) git bash- heroku keys:addheroku에 동일한 키를 업로드하는 데 사용 합니다.

이제 git push heroku master작동합니다.

이 악몽이 누군가에게 도움이 되었기를 바랍니다.

브라이언


내가 겪고있는 문제는 내 GitHub 계정에 https 만 사용하고 있다는 것입니다. 내 GitHub 계정이 ssh 액세스를 위해 설정되었고 GitHub와 heroku가 동일한 공개 키를 사용하고 있는지 확인해야했습니다. 내가 취한 단계는 다음과 같습니다.

  1. ~ / .ssh 디렉토리로 이동하여 id_rsa 및 id_rsa.pub가 있으면 삭제하십시오. 필요하지 않을 수도 있지만 새 키로 시작했습니다.

    $ cd ~/.ssh
    $ rm id_rsa id_rsa.pub
    
  2. gitHub의 단계에 따라 ssh 키생성 하십시오.
  3. heroku에 로그인하여 새 사이트를 만들고 공개 키를 추가하십시오.

    $ heroku login
    ...
    $ heroku create
    $ heroku keys:add
    $ git push heroku master
    

i had the same case on linux ubuntu and just fixed it, it seems that OS was confused between the /root/.ssh/ and home/user/.ssh/ dir, what i did was:

  1. removed all keys from root and home/user .shh directory.
  2. generated a new key make sure to pay attention to the path of creation (/home/you/.ssh/id_rsa) or (/root/.ssh/id_rsa)
  3. check heroku keys heroku keys
  4. if keys in there clear heroku keys:clear
  5. heroku keys:add now in here if heroku couldn't find a key and asked to generate one right no, and this mean you have the same issue as mine, do the add command like this heroku keys:add /root/.ssh/id_rsa.pub the path that you'll add will be the one that you got in step 2.
  6. try git push heroku master now

My way on Windows 8

  1. Add a directory with ssh-keygen to the system PATH variable, usually C:\Program Files (x86)\Git\bin

  2. Open CMD, go to C:\Users\Me\

  3. Generate SSH key ssh-keygen -t rsa

    Enter file in which to save the key (//.ssh/id_rsa): .ssh/id_rsa (change a default incorrect path to .ssh/somegoodname_rsa)

  4. Add the key to Heroku heroku keys:add

    Select a created key from a list

  5. Go to your app directory, write some beautiful code

  6. Init a git repo git init git add . git commit -m 'chore(release): v0.0.1

  7. Create Heroku application heroku create

  8. Deploy your app git push heroku master

  9. Open your app heroku open


Had a similar issue, and tried lots of things. Ultimately what worked for me, was to have Gnu on Windows installed (https://github.com/bmatzelle/gow/releases) , and ensure that it was using the ssh tool inside that directory and not the one with Git. Once installed test with (ensure if its in your environment PATH that it preceds Git\bin)

C:\Git\htest2>which ssh
C:\Program Files (x86)\Gow\bin\ssh.BAT

I used putty and pageant as described here:http://rubyonrailswin.wordpress.com/2010/03/08/getting-git-to-work-on-heroku-on-windows-using-putty-plink-pageant/

Once the keys had been sent to heroku (heroku keys:add c:\Users\Person.ssh\id_rsa.pub), use

ssh -v <username>@heroku.com 

and ensure that your stack is showing use of Putty - ie a working stack:

Looking up host "heroku.com"
Connecting to 50.19.85.132 port 22
Server version: SSH-2.0-Twisted
Using SSH protocol version 2
**We claim version: SSH-2.0-PuTTY_Release_0.62**
Using Diffie-Hellman with standard group "group1"
Doing Diffie-Hellman key exchange with hash SHA-1
Host key fingerprint is:
ssh-rsa 2048 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad
Initialised AES-256 SDCTR client->server encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised AES-256 SDCTR server->client encryption
Initialised HMAC-SHA1 server->client MAC algorithm
Pageant is running. Requesting keys.
Pageant has 1 SSH-2 keys
Using username "*--ommitted for security--*".
**Trying Pageant key #0**
Authenticating with public key "rsa-key-20140401" from agent
Sending Pageant's response
Access granted
Opened channel for session
Server refused to allocate pty
Server refused to start a shell/command
FATAL ERROR: Server refused to start a shell/command

One that was running previously and failed:

C:\Git\htest2>ssh -v <username>@gmail.com@heroku.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to heroku.com [50.19.85.156] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Person/.ssh/identity type -1
debug1: identity file /c/Users/Person/.ssh/id_rsa type 1
debug1: identity file /c/Users/Person/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version Twisted
debug1: no match: Twisted
debug1: Enabling compatibility mode for protocol 2.0
**debug1: Local version string SSH-2.0-OpenSSH_4.6**
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /c/Users/Person/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/Person/.ssh/identity
debug1: Offering public key: /c/Users/Person/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Trying private key: /c/Users/Person/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

you need to create a new ssh key by typing the following - ssh-keygen -t rsa

Then you need to add: - heroku keys:add

Then if you type - heroku open

The problem has been solved.

It worked for me anyway, you could give it a try...


I got the same error, and because I have 4 ssh-keys, so I tried follow:

ssh-keygen -t rsa
heroku keys:add

then, four options show:

1) github_rsa.pub
2) id_boot2docker.pub
3) id_rsa.pub
4) sshkey.pub

I choose 3), the newest one

Then, I fix the error.


I use this method to solve this problem Maybe you can try it

"Enable ssh-agent"

  1. Download git

http://git-scm.com/

  1. Install it

  2. Enable ssh-agent

C:\Program Files\Git\cmd

start-ssh-agent

The message disapper after I agent enabled Hope this will help you


I'd like to add another solution since I didn't see it here. My problem was that heroku was linking to the wrong url (since I kept playing around with url names). Editing the remote url solved my problem:

git remote set-url heroku <heroku-url-here>

I had the same issue. And I tried to reset my keys as everyone said, but it still didn't worked. For was because I renamed the app.

So what I did was to reset my keys and also rename app from console. Check this question for more information: Heroku push app problem


SO So So simple solution , go to c:/Users/user_name/.ssh/ and delete all pub / private key pairs , this way heroku will generate keys for you.


I had a similar heroku ssh error that I could not resolve.

As a workaround, I used the new heroku http-git feature (http transport for "heroku" remote instead of ssh). Details here: https://devcenter.heroku.com/articles/http-git

(Short version: if you have a project already setup the standard way, run heroku git:remote --http-init to change "heroku" remote to http.)

A good quick work around if you don't have time to fix/troubleshoot an ssh issue.

참고URL : https://stackoverflow.com/questions/17626944/heroku-permission-denied-publickey-fatal-could-not-read-from-remote-reposito

반응형