Programing

키 지문 때문에 Heroku로 푸시 할 수 없습니다

lottogame 2020. 6. 29. 08:03
반응형

키 지문 때문에 Heroku로 푸시 할 수 없습니다


저는 Rails를 처음 사용하고 있으며 매우 간단한 앱을 Heroku에 배포하려고했습니다. 이것은 내가 배포 한 두 번째 응용 프로그램이며 첫 번째 응용 프로그램은 정상적으로 작동합니다. 그러나 나는 이것에 약간의 문제가 있습니다. " git push heroku master " 마다이 오류가 발생합니다.

! 지문이 xx : xx : xx : xx : xx : xx : xx : xx : xx : xx : xx : xx : xx : xx : xx : xx 인 키는 my_heroku_app에 액세스 할 권한이 없습니다.

치명적인 : 원격 끝이 예기치 않게 끊어졌습니다.

heroku에 로그인 한 후 키 관리를 시도했습니다. 콘솔 " heroku keys "를 입력하면 다음과 같은 결과가 나타납니다.

myemailaddress에 대한 키가 없습니다.

그러나 comand " heroku keys : add "를 실행 하면

기존 공개 키를 찾았습니다. /Users/michele/.ssh/id_rsa.pub ssh 공개 키 업로드 /Users/michele/.ssh/id_rsa.pub! 지문이 이미 존재합니다. Heroku 계정 당 하나의 ssh 키를 사용하십시오

도와주세요! 이것은 너무 실망 스럽습니다. 무슨 일인지 모르겠습니다! 감사합니다


나는 같은 문제가 있었고, 나는이 게시물과 같은 종류의 다른 사람들을 성공없이 따랐다 :-((

마지막으로 해결책을 찾았습니다. 내 컴퓨터에 새로운 rsa ID를 추가해야했습니다!

그래서 우선 새로운 rsa 키를 만들었습니다.

ssh-keygen -t rsa -C "giordano.scalzo[at]gmail.com" -f  ~/.ssh/id_rsa_heroku

그런 다음 내 컴퓨터에 추가했습니다.

ssh-add ~/.ssh/id_rsa_heroku

그리고 마지막으로 헤 로쿠에게

heroku keys:add ~/.ssh/id_rsa_heroku.pub

그 후

git push heroku master

매력처럼 일했다!

도움이 되었기를 바랍니다.


나도 여러 개의 키와 여러 개의 heroku 계정을 가지고 있기 때문에 몇 달마다이 문제가 발생합니다. Giordano Scalzo, Tom Carchrae 및 user664833에서 언급했듯이 주요 문제점은 ssh-agent이며 ssh-add명령을 사용하여 제어합니다 . 매뉴얼 페이지 ( man ssh-add)는 실제로 매우 명확하고 간결하므로 확인하십시오.

ssh-agent가 알고있는 모든 키를 나열 할 수 있습니다.

ssh-add -l

ssh-agent가 알고있는 모든 키를 삭제할 수 있습니다.

ssh-add -D

또는로 특정 키를 삭제하십시오.

ssh-add -d ~/.ssh/id_rsa_example_key_file_use_your_own

걱정 마세요! 실제로 키를 삭제하지 않고, 예를 들어, heroku로 푸시하려고 할 때 ssh-agent가 자동으로 사용하려는 키만 변경합니다. 필요에 따라 키를 쉽게 추가하고 삭제할 수 있으므로이 문제에 좌절 할 때 가장 쉽게 해결할 수있는 방법은 모든 키를 삭제하고 현재 사용하려는 키만 다시 추가하는 것입니다.

ssh-add -D
ssh-add ~/.ssh/id_rsa_example_use_this_one_i_mean_it

컴퓨터에 SSH 키가 있지만 해당 SSH 키가 다른 Heroku 계정과 연결되어 있습니다.

같은 컴퓨터에서 다른 응용 프로그램에 두 계정을 모두 사용해야하는 경우 컴퓨터에서 새 SSH 키를 만들어 Heroku에 업로드해야합니다.

$ ssh-keygen

프롬프트가 표시되면 '/Users/User/.ssh/new_id_rsa.pub'으로 저장하십시오.

$ heroku keys:add /Users/User/.ssh/new_id_rsa.pub 

그런 다음에 대한 대체 호스트를 추가해야 heroku.com합니다 ~/.ssh/config.

Host heroku-alt
HostName heroku.com
IdentityFile ~/.ssh/new_id_rsa

그런 다음 .git/config프로젝트에서 를 업데이트 하여 호스트 별명을 사용하십시오.

[remote "heroku"]
  url = git@heroku-alt:myapp.git
  fetch = +refs/heads/*:refs/remotes/heroku/*

사이의 선택에 의하여 herokuheroku-alt의 원격에 .git/config당신이 어떤 자격 증명을 사용하는 프로젝트를 관리 할 수있는 특정 프로젝트의 파일입니다.


여기에 Heroku 문서 또는 다른 질문에 대한 답변이 부족한 매우 명확한 설명이 있습니다. 최소한 모든 정보가 한 곳에 나타나지 않는 것 같습니다. 또한 계정 도구에서 지원하지 않는 방식으로 문제를 이해할 수 있습니다.

Heroku는 두 가지 방법으로 당신을 식별합니다 :

첫 번째는 .git / config에 있습니다.

[heroku]
    account = acccount_name

이것은 당신이 사용하여 기본 작업을 수행 할 수있는 것 같습니다 heroku

heroku가 사용자를 식별하는 두 번째 방법은 ssh (git push)를 사용하는 조작입니다. Heroku는 https://devcenter.heroku.com/articles/keys에 명시된대로 ssh 키로 사용자를 식별합니다.

이 키 쌍은 강력한 암호화에 사용되며 코드 변경을 추진할 때 개발자로 고유하게 식별됩니다.

따라서 작업하는 각 heroku 계정은 ssh를 사용할 때 heroku에 다른 키를 보내야합니다. 자습서를 따라 ssh 키를 작성하십시오.

The key is getting SSH to use different keys for each Heroku account. How do you do configure this? You'll need to do 2 things:

1) You'll need to make a 'dummy' domain that your .ssh/config will intercept and reconfigure. This will tell ssh the 'actual' domain you want, and which special ssh key to use.

Host heroku.my_unique_key
  HostName heroku.com
  IdentityFile ~/.ssh/identity.heroku.my_unique_key
  IdentitiesOnly yes

2) Change your .git/config to use that when using git push. Instead of heroku.com, use the dummy domain you set in your .ssh/config

[remote "heroku"]
    url = git@heroku.com.git


[remote "heroku"]
    url = git@heroku.my_unique_key:myapp.git

That's it :) A bit complicated and a bit simple at the same time. It has taken me 3 years of banging my head against the wall and trial and error to discover this info. It should be clearly documented somewhere, but at least it's a start.


youn will need to create new keys and add those

specify a new file name after running

ssh-keygen

then (in my case)

heroku keys:add /home/alex/.ssh/alex_heroku_rsa.pub

I have the same issue last week. This linked helped me out. I hope it helps you out a little. http://devcenter.heroku.com/articles/keys


In my case, heroku keys already had the correct key listed. So, all I had to do was run ssh-add /path/to/that/key and then everything started working fine.


I also have two Heorku accounts and as a work-around I "invited" my main account (the one whose key is used automatically by Heroku) as a collaborator to my project.


Just wan´t to add the solution for Windows users.

  1. First download "Putty Key generator"

  2. Create a key with it OBS you need to move your mouse ower the blank area to generate randomness.

  3. Save your keys, just remeber to rename your key to [name].pub

  4. Run heroku keys:add in terminal!


In my case the problem was the ssh version I was using. I just set the GIT_SSH environment variable to another ("GIT_SSH=/usr/bin/ssh") and everything worked OK for me.

참고URL : https://stackoverflow.com/questions/8786564/cannot-push-to-heroku-because-key-fingerprint

반응형