Windows 7에서 git 사용 권한이 거부 됨 (공개 키) 오류
이 명령으로 github로 푸시하고 싶을 때
git push origin master
알 겠어
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
그래서, 무엇이 잘못 되었나요?
유레카!
분명히 plink
주 ssh 클라이언트로 사용하고 키를로드 할 수 있습니다 pageant
(나와 같다면 이미 수행하고 있습니다).
GIT_SSH
env 변수를 다음 plink.exe
과 같이 path 로 설정하면됩니다 .
GIT_SSH = C : \ Program Files \ PuTTY \ plink.exe 설정
또는 TortoiseGit에서 plink를 사용할 수 있습니다.
GIT_SSH = c : \ Program Files \ TortoiseGit \ bin \ TortoisePLink.exe 설정
출처 : 이 블로그 게시물 에서 가져온 원래 솔루션
이 문제를 다음과 같이 해결할 수있었습니다.
당신이 할 때 :
ssh-keygen -t rsa
(선택적으로) 생성 된 키를 저장할 파일 이름을 입력하라는 메시지가 표시됩니다. 파일 이름을 지정하는 것은 하루 종일 낭비였습니다! 다음날 기본 파일 이름을 사용하고 문제가 사라졌습니다! 상상!
플랫폼은 Win7 및 msysgit입니다.
다음은이 작업을 수행하는 데 사용한 단계별 가이드입니다.
플랫폼 : Windows 7
http://msysgit.github.io/ 에서 msysgit 설치
설치하는 동안 '구성 요소 선택'옵션이 나타나는 경우를 제외하고 모든 기본 옵션을 수락합니다. 이것이 나타나면 'Git Bash Here'옵션을 선택하십시오. 이것이 꼭 필요한 것은 아니지만 Windows 탐색기에서 작업 할 때 매우 유용한 컨텍스트 메뉴를 추가합니다.
msysgit이 설치되면 Git Bash도 설치됩니다. 다음 두 가지 방법 중 하나로 Git Bash를 엽니 다.
- Windows 시작 키를 클릭하고 Git Bash 입력을 시작합니다.
- 또는 어딘가 (예 : 데스크톱)를 마우스 오른쪽 버튼으로 클릭하고 여기에 Git Bash를 선택합니다. 이 옵션은 'Git Bash Here'컨텍스트 메뉴가 설치된 경우에만 사용할 수 있습니다.
Git Bash의 명령 창에서 다음을 입력하십시오.
$ ssh-keygen -t rsa
파일 이름을 입력하라는 메시지가 표시되면 기본값을 그대로 사용하십시오. 메시지가 표시되면 강력한 암호를 선택하면 이제 공개 키가 저장됩니다. 화면은 다음과 같아야합니다.
메모장에서 공개 키 파일을 엽니 다. 파일은 여기에 있어야합니다.
C:\Users\{username}\.ssh\id_rsa.pub
파일의 모든 콘텐츠를 클립 보드에 복사 한 다음 GitHub의 SSH 설정 페이지로 이동합니다.
https://github.com/settings/ssh
'SSH 키 추가'를 선택하고 유용한 '제목'을 입력하고 콘텐츠를 '키'텍스트 영역에 붙여 넣습니다.
생활을 단순화하기 위해 SSH 에이전트를 사용하여 암호를 기억할 필요가 없도록 저장할 수 있습니다. 이렇게하려면 Git Bash에 다음을 입력하십시오.
$ eval `ssh-agent -s`
$ ssh-add ~/.ssh/id_rsa
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:
$ ssh -T git@github.com
You should see a 'success' meesage.
Sources:
https://help.github.com/articles/generating-ssh-keys/
https://help.github.com/articles/working-with-ssh-key-passphrases/
explanation on why eval `ssh-agent -s` should be used instead of just ssh-agent -s
https://stackoverflow.com/a/17848593/188740
Have you generated an SSH key for yourself and added it to your Github account? They have a guide for this here.
Using Windows 8 to setup your ssh and Github
If it says "Permission denied (publickey)" you will have to put in a passphrase for your key. Do not be tempted to just press enter...this was what worked for me...it took me five hours to realize that pressing enter made OpenSSH feel that your key was too public so that is why it is denying you from going to the next step.
If it says "The authenticity of host 'github.com (203.232.175.90)' can't be established." Then you will have to go through the process shown here: [Google] (https://help.github.com/articles/error-permission-denied-publickey.)
Go to the part that says "Verify the public key is attached to your GitHub account". You want to start with the part that says account. (I am assuming you already have an account.
Also, you want to be in C:\RailsInstaller\Git.ssh and when I did 'dir' I noticed that I had '.', '..', 'known_hosts'. I had to get a new key by doing the following (I found this on the Github site):
"ssh-keygen -t rsa -C "your_email@example.com" # Creates a new ssh key, using the provided email as a label # Generating public/private rsa key pair. < # Enter file in which to save the key(/c/Users/you/.ssh/id_rsa): [Press enter]"
And pay attention to the file where the key will be saved. Do not just press enter.. my one showed "(//.ssh/id_rsa)" I had to type "/.ssh/id_rsa" to make sure it was in the right directory.
And you should be able to type ssh in the command line. If you cannot do that you will have to add it to your path.
I solved a similar problem by adding a System Environment Variable. The key was that I am pointing to the git.exe inside the cmd folder
name: GIT
value: C:\Program Files (x86)\Git\cmd\git.exe
there could be something wrong with your heroku keys. try:
heroku keys:add
similar question here: Heroku Git - fatal: The remote end hung up unexpectedly
If you have already generated the key, and it has a default name, the problem might be in the absent environment variable.
On Windows 7 right click "My computer" and go to properties. There click on advanced properties and click the button Environment Variables. There add a user environment variable
Name: HOME
Value: %USERPROFILE%
The problem may be related to the order in which the ssh.exe are in the PATH environmental variable.
In my case there was a ssh.exe in both the C:\Program Files(x86)\git and also in my C:\cwgwin directory. When I was in my Git Bash everything worked fine (it was using the ssh in the git directory) but when I was in my Command Prompt it was using the ssh in my cygwin directory.
When I tried to access github it was not able to find the .ssh folder with my private key because the key was not attached to the ssh the command prompt was using (ie the C:\cygwin one) and that is why I was getting the Permission Denied error.
What I did was rename (or delete) the git.exe and ssh.exe in my C:\cygwin directory and make sure that C:\Program Files(x86)\git appears before the C:\cwgwin in the PATH order.
Here is a solution to a very specific problem that has the same error signature. This was the mistake I made and it is very easy to make. Basically, instead of doing this
git remote add origin git@github.com:myusername/myrepo.git
I did this (note typo)
git remote add origin get@github.com:myusername/myrepo.git
http://www.celticwolf.com/blog/2011/02/08/git-permission-denied-publickey/
Here is the default output for Windows 7.
c:\test\app>ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (//.ssh/id_rsa):
Could not create directory '//.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
open //.ssh/id_rsa failed: No such host or network path.
Saving the key failed: //.ssh/id_rsa.
Instead of command prompt git is to be used as per http://help.github.com/win-set-up-git/ ??
I had a similar problem:
I created "redssh" and "redssh.pub" in some directory using git bash. Permission denied...
however, "id_rsa.pub" and "id_rsa" had appeared in: C:/Users/myName/.ssh/
copy id_rsa.pub contents to github
I'm a total newb with git and was following some installation instruction on a website and was getting the permission denied (publickey) error.
I followed the instructions to generate the RSA key pairs (ssh-keygen -t rsa). This worked fine but I was still getting the error. What I did not realize was that you have to actually go the the GIT website (github.com), register and enter that key on their website.
I hope this helps out another poor newb out there.
Cheers!
I had similar Prob in win 8.
Very Simple mistake I did: I have already created public key in git hub account so that y keys was not getting match.
Solution:
- delete ssh folder and key from github account and do it again the process
1) ssh-keygen -t rsa -C "your mail address"
2) ssh -T git@github.com
I discovered that my problem was that whatever version of ssh-keygen that I used created the files with the wrong filenames... The files initially created where %USER_HOME%.ssh\ida_rsa and ida_rsa.pub, but git expected them to be id_rsa and id_rsa.pub.
git bash를 실행하고 ssh-keygen을 실행하여 문제를 해결했습니다.
참고 URL : https://stackoverflow.com/questions/2127104/permission-denied-publickey-error-using-git-on-windows-7
'programing tip' 카테고리의 다른 글
C에서 char 문자열을 수정할 수 있습니까? (0) | 2020.11.26 |
---|---|
.NET C #에서 전체 단어의 문자열 자르기 (0) | 2020.11.26 |
Maven에서 디버깅? (0) | 2020.11.26 |
ProgressDialog에서 진행률 표시기를 쉽게 중앙에 배치하는 방법 (제목 / 텍스트가 전달되지 않은 경우) (0) | 2020.11.26 |
JQuery를 사용하여 : Before CSS 선택기의 너비 속성 변경 (0) | 2020.11.26 |