Windows에서 git이 암호를 기억하지 못하는 이유
방금 git을 사용하기 시작했으며 cmd.exe를 사용하고 암호 호스트를 기억하고 암호 호스트를 기억할 수 없습니다 .git 호스트는 github이며 github에서 해당 가이드와 같은 ssh 키를 만들었습니다.
하지만 난 여전히 얻는다
*\subnus.mvc>git push origin master
Enter passphrase for key '/c/Users/Subnus/.ssh/id_rsa':
나는이 질문이 2 살에 온다는 것을 알고 있지만, 같은 문제가 있었고 여기에 대한 몇 가지 대답이 나에게 대한 질문에 완전히 대답하지 못했습니다. 다음은 msysgit 외에 TortoiseGit을 사용하는지 여부에 따라 두 가지 단계별 솔루션입니다.
첫 번째 솔루션 Windows, msysgit 및 PuTTY를 가정합니다.
- 지시에 따라 msysgit 및 PuTTY를 설치하십시오.
- (선택 사항) 경로에 PuTTY를 추가하십시오. (이 작업을 수행하지 않으면 아래의 PuTTY 명령에 대한 모든 참조 앞에 해당 실행 파일의 전체 경로가 있어야합니다.)
- 아직 그렇게하지 않았다면, GitHub에서 지시하거나 Git 호스트가 지시 한대로 키 해시를 생성하십시오.
- 다시 말하지만, 아직 그렇게하지 않았다면 puttygen.exe 를 사용하여 PuTTY 's pageant.exe와 함께 사용하도록 키를 변환하십시오 . 지침은 PuTTY의 설명서, 이 유용한 안내서 및 사이버 공간의 여러 곳에 있습니다.
- PuTTY 's pageant.exe를 실행하고 .ppk 파일 ( "키 추가")을 열고 키의 암호를 입력하십시오.
Windows 환경 변수 대화 상자에 액세스하십시오 ( "컴퓨터"를 마우스 오른쪽 단추로 클릭하고 "속성"을 클릭 한 다음 "고급 시스템 설정"또는 "고급"탭을 클릭하고 "환경 변수"를 클릭하십시오)). 다음 환경 변수를 추가하십시오.
GIT_SSH = C : \ full \ path \ to \ plink.exe
"C : \ full \ path \ to"를 plink.exe가있는 PuTTY의 전체 설치 경로로 바꾸십시오. "사용자 변수"섹션에 추가하는 것이 가장 좋습니다. 또한 plink.exe에 사용하는 경로가 Pageant (pageant.exe)에 사용하는 경로와 일치하는지 확인하십시오. 경우에 따라 다른 응용 프로그램과 함께 설치 될 수 있으므로 PuTTY를 여러 번 설치할 수 있습니다. 한 설치에서 plink.exe를 사용하고 다른 설치에서 pageant.exe를 사용하면 문제가 발생할 수 있습니다.
명령 프롬프트를여십시오.
Github.com에서 호스팅되는 git 저장소에 연결하려는 경우 다음 명령을 실행하십시오.
plink.exe git@github.com
연결하려는 자식 저장소가 다른 곳에서 호스팅 되는 경우 git@github.com 을 적절한 사용자 이름과 URL 로 바꾸 십시오 . (Github 가정) 서버의 호스트 키가 캐시되지 않았다는 메시지가 표시되고이를 신뢰하는지 묻습니다. y로 답하십시오 . 그러면 PuTTY의 알려진 호스트 목록에 서버의 호스트 키가 추가됩니다. 이 단계가 없으면 git 명령이 제대로 작동하지 않습니다. Enter 키를 누르면 Github은 Github이 쉘 액세스를 제공하지 않음을 알려줍니다. 괜찮습니다 ... 필요하지 않습니다. (다른 호스트에 연결하고 쉘 액세스를 제공하는 경우 다른 작업을 수행하지 않고 링크를 종료하는 것이 가장 좋습니다.)
- 다 했어요! 힘내 명령은 이제 명령 행에서 작동합니다. 부팅 시점에 pageant.exe가 .ppk 파일을 자동으로로드 하도록 할 수도 있습니다.
두 번째 솔루션 Windows, msysgit 및 TortoiseGit을 가정합니다.
TortoiseGit에는 PuTTY 실행 파일과 작업을 쉽게 할 수 있도록 특별히 수정 된 plink 버전 (TortoisePlink.exe)이 포함되어 있습니다.
- 지시에 따라 msysgit 및 TortoiseGit를 설치하십시오.
- 아직 그렇게하지 않았다면, GitHub에서 지시하거나 Git 호스트가 지시 한대로 키 해시를 생성하십시오.
- 다시 말하지만, 아직 그렇게하지 않았다면 TortoiseGit의 puttygen.exe 를 사용하여 TortoiseGit의 pageant.exe와 함께 사용하도록 키를 변환하십시오 . 지침은 PuTTY의 설명서, 첫 번째 솔루션에 링크 된 유용한 가이드 및 사이버 공간의 여러 곳에 있습니다.
- TortoiseGit의 pageant.exe를 실행하고 .ppk 파일 ( "키 추가")을 열고 키의 암호를 입력하십시오.
Windows 환경 변수 대화 상자에 액세스하십시오 ( "컴퓨터"를 마우스 오른쪽 단추로 클릭하고 "속성"을 클릭 한 다음 "고급 시스템 설정"또는 "고급"탭을 클릭하고 "환경 변수"를 클릭하십시오)). 다음 환경 변수를 추가하십시오.
GIT_SSH = C : \ full \ path \ to \ TortoisePlink.exe
"C : \ full \ path \ to"를 TortoisePlink.exe가있는 TortoiseGit의 전체 설치 경로로 바꾸십시오. "사용자 변수"섹션에 추가하는 것이 가장 좋습니다. 또한 TortoisePlink.exe에 사용하는 경로가 Pageant (pageant.exe)에 사용하는 경로와 일치해야합니다. 경우에 따라 다른 응용 프로그램과 함께 설치 될 수 있으므로 PuTTY를 여러 번 설치할 수 있습니다. TortoiseGit 설치에서 TortoisePlink.exe를 사용하고 다른 응용 프로그램의 다른 설치 (또는 독립 실행 형 PuTTY 설치)에서 pageant.exe를 사용하면 문제가 발생할 수 있습니다.
다 했어요! 힘내 명령은 이제 명령 행에서 작동합니다. git 리포지토리에 처음 연결을 시도하면 서버의 호스트 키가 캐시되지 않았 음을 알리고 서버를 신뢰할 것인지 묻습니다. "예"를 클릭하십시오. (이것은 TortoisePlink.exe입니다.)
부팅 시점에 pageant.exe가 .ppk 파일을 자동으로로드 하도록 할 수도 있습니다.
세 번째 솔루션 Window, msysgit 및 기본 명령 프롬프트를 가정합니다.
- msysgit 설치
- MS-DOS 명령 프롬프트에서 git을 사용하도록하십시오.
- 운영
start-ssh-agent
- SSH 암호를 입력하십시오
- 다 했어요! 힘내 명령은 이제 기본 명령 프롬프트에서 작동합니다.
자세한 지침이 필요한 사람은 다음 페이지를 참조하십시오. http://help.github.com/working-with-key-passphrases/
질문이 게시 된 후 5 년, 8 개월 및 6 일의 추가 솔루션 하나는 나쁜 생각이 아니므로 여기로 이동하십시오.
참고 : Windows 컴퓨터를 사용한다고 가정합니다.
- git-credential-winstore를 다운로드하십시오 .
- 그것을 실행하십시오!
PATH
환경 변수에 GIT가 있으면 제대로 작동합니다. 그렇지 않으면을 실행하십시오git-credential-winstore -i C:\Path\To\Git.exe
.
다음에 리포지토리에 커밋하려고하면 자격 증명을 입력하라는 메시지가 표시됩니다. 그게 다야. 비밀번호를 변경할 때까지 더 이상 자격 증명을 요구하지 않습니다.
여러분의 지식을 위해 ... 자격 증명은 Windows 자격 증명 저장소에 저장됩니다.
자격 증명을 어디에 저장합니까?
This app just uses the existing Windows Credential Store to hold your credentials. You can see the stored credentials by going to Control Panel > User Accounts > Credential Manager and choosing "Windows Credentials". The entries starting "git:" are from git-credential-winstore.
In case you are using Git bash under Windows you can perform the following:
eval `ssh-agent -s`
ssh-add ~/.ssh/*_rsa
it will ask for pass phrase in the second command, and that's it. Each additional action you will need to do (which once required pass phrase) won't ask you for the pass phrase (see an example in the screen shot below):
Hope it helps.
Cheers,
Guy.
That's not git, it's ssh.
I don't do windows, but ssh has an agent concept that can remember passphrases for you. OS X has this enabled by default. Your ssh client probably has a way to configure this.
If you set a password for your key file, you'll always need to type in that password when connecting. If you create a passwordless key, then you won't have to type it every time, however, anyone with access to your key file can now connect to your github account.
ssh-agent may also work. Try running that and see if it will remember your passphrase.
[edit - misread the question, this is an answer to a related problem. leaving rephrased version for posterity]
My case was that I was trying to push to a repo that was hosted on one of our servers. Whenever I tried to do a push, git would ask me for my password (nb - password, not the passphrase to my private key).
By adding my public key to the authorised keys on the server, I was able to get password-free pushes to that server. And, because there was no passphrase on my private key (which is bad practice btw!) I didn't need to type anything at all in.
Here's the command to add your public key to a server. It assumes the user git
is the user on the server.
cat .ssh/id_rsa.pub | ssh git@GIT_MASTER_IP 'cat >> .ssh/authorized_keys'
You could achieve the same thing by logging onto the server, and manually appending your public key to the file at ~/.ssh/authorized_keys
I realise this is several years overdue, but I stumbled across this question trying to find a solution for it, and I found something that suits all levels of expertise, so I thought I'd share.
GitHub provide a very helpful installer that makes everything nice and easy: https://help.github.com/articles/caching-your-github-password-in-git/
There is a much simpler solution to this problem if you don't mind having you password stored in plaintext and you're using TortoiseGit.
Simply create a _netrc
file in your user profile directory - ie in Windows 7 it would be C:\Users\MyName\_netrc
. This file will store your login information in this format:
machine bitbucket.org login thisismyname password p455w0rD
machine bitbucket.org login another_account password pwdpwdPWd
machine github.com login thisismynameagain password p455w0rD
I'm using TortoisePLink as a SSH client and it works flawlessly.
You can create a .bashrc
file in the home directory of your user like C:/Users/youruser
, and put there:
env=~/.ssh/agent.env
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
agent_start () {
(umask 077; ssh-agent >| "$env")
. "$env" >| /dev/null ; }
agent_load_env
# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
agent_start
ssh-add
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
ssh-add
fi
unset env
This script executes every time after bash runs. So you will need to enter the password only once, when git-bash
is started!
Some versions of bash require .bash_profile
file instead .bashrc
, so just in case clone .bashrc
:
copy .bashrc .bash_profile
can try adding -k arg when you do;
ssh-add -k ~/.ssh/id_rsa
참고URL : https://stackoverflow.com/questions/370030/why-git-cant-remember-my-passphrase-under-windows
'Programing' 카테고리의 다른 글
Javascript에서 키 / 값 객체를 반복하는 방법은 무엇입니까? (0) | 2020.07.07 |
---|---|
내 Android Gradle 기반 프로젝트에 -Xlint : unchecked를 추가하는 방법은 무엇입니까? (0) | 2020.07.07 |
NSTextField에서 텍스트를 어떻게 설정합니까? (0) | 2020.07.07 |
PHP는 속성이 객체 또는 클래스에 존재하는지 확인 (0) | 2020.07.07 |
linq에서 2 개의 필드로 orderby를 사용하는 방법은 무엇입니까? (0) | 2020.07.07 |