๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
IT-Engineering/TroubleShooting

Git Push๋ฅผ ๊ท€์ฐฎ๊ฒŒ ๋งŒ๋“œ๋Š” ์—๋Ÿฌ ํ•ด๊ฒฐ: Enter passphrase for key '~/.ssh/id_rsa' ๋ฌธ์ œ์™€ Could not open a connection to your authentication agent. ๋ฌธ์ œ ๋‘˜๋‹ค ํ•ด๊ฒฐํ•˜๊ธฐ

by ๐Ÿงž‍โ™‚๏ธ 2020. 9. 11.
๋ฐ˜์‘ํ˜•

์–ธ์  ๊ฐ€๋ถ€ํ„ฐ https๋กœ git repository๋กœ๋ถ€ํ„ฐ ์†Œ์Šค๋ฅผ ๋ฐ›์„ ๋•Œ ์ž๊พธ ๊ณ„์ • ํ™•์ธ์ด ๋œจ๋Š”๊ฒŒ ๊ท€์ฐฎ์•˜๋‹ค. ๊ทธ๋ž˜์„œ ssh key๋“ฑ๋ก์„ ํ•˜๊ณ  ํ•œ๋ฒˆ ๊ท€์ฐฎ์Œ์„ ๊ฐ์ˆ˜ํ•˜๊ณ  ๊ณ„์† ํŽธํ•˜๊ฒŒ ํ•˜๋ ค๊ณ  ssh ์„ค์ •์„ ๊ฐํ–‰ํ–ˆ๋‹ค.

 

git push์‹œ ์ž๋™ ๋กœ๊ทธ์ธ ์„ค์ • - username, password๊ทธ๋งŒ ์ž…๋ ฅํ•˜์ž

github respository์— git push -u origin master ๋ฅผ ํ–ˆ์„ ๋•Œ ์•„๋ž˜์™€ ๊ฐ™์ด ์ž๊พธ ๋กœ๊ทธ์ธ์„ ์š”์ฒญํ•˜๋Š” ๊ฒฝ์šฐ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ์ •๋ฆฌ. repository์ฃผ์†Œ๋ฅผ https ๋กœ ๋ฐ›์•„์„œ ์ฒ˜๋ฆฌํ•˜๋˜ ๊ฒฝ์šฐ์— ํ”„๋กœํ† ์ฝœ์„ ssh ๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค..

gentlesark.tistory.com

ํ•จ๊ป˜๋ณด๋ฉด ์ข‹์€ ๊ธ€

๊ทธ๋Ÿฐ๋ฐ ์–ด์ฉ ์ผ์ธ์ง€ ์ž‘์—…ํ•˜๋Š” ์ปดํ“จํ„ฐ ์ค‘ ํ•œ ๋†ˆ์€ ์ง€์†์ ์œผ๋กœ ์•„๋ž˜์˜ ๋ฉ”์‹œ์ง€๋ฅผ ๋ฑ‰๋Š” ๊ฒƒ์ด ์•„๋‹Œ๊ฐ€? (์ฐธ๊ณ ๋กœ ํ•„์ž๋Š” Windows์—์„œ ์ปจํ…์ŠคํŠธ ๋ฉ”๋‰ด๋ฅผ ํ†ตํ•ด Git Bash๋ฅผ ์ผœ์„œ ์ฃผ๋กœ git ์ž‘์—…์„ ํ•œ๋‹ค. ๋ฆฌ๋ˆ…์Šค์™€ ์™”๋‹ค๊ฐ”๋‹ค ํ•  ๋•Œ ํ˜ผ๋™์„ ์ตœ์†Œํ™”ํ•  ์ˆ˜  ์žˆ๊ธฐ ๋•Œ๋ฌธ.)

Enter passphrase for key '~/.ssh/id_rsa':

์•„์˜ค ํ•  ๋•Œ ๋งˆ๋‹ค ssh ํ‚ค์— ๋Œ€ํ•œ ์•”ํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜๋ผ๋‹ˆ ์—ฌ๊ฐ„ ๊ท€์ฐฎ์€ ์ผ์ด ์•„๋‹ˆ๋‹ค. ์ด๋Œ€๋กœ ์ด ๋ฌธ์ œ๋ฅผ ๋ฐฉ์น˜ํ•  ์ˆ˜๋Š” ์—†์–ด์„œ ํ•ด๊ฒฐ๋ฐฉ๋ฒ•์„ ์ฐพ์•„๋ณด์•˜๋‹ค.

๋ฌธ์ œ๋Š” ssh-agent๊ฐ€ ์ด ํ‚ค๋ฅผ ์ €์žฅํ•˜๊ณ  ์žˆ์ง€ ์•Š์•„์„œ ๋งค๋ฒˆ ๋ฌผ์–ด๋ณด๋Š” ๋ฌธ์ œ์˜€๋‹ค. ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์€ ์•„๋ž˜์˜ ์ปค๋งจ๋“œ๋‹ค.

 ssh-add ~/.ssh/id_rsa

๊ทธ๋Ÿฐ๋ฐ ๋˜ ์ด๋Ÿฐ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ๊ฐ€!?

Could not open a connection to your authentication agent.

์ด ๋ฌธ์ œ๋Š” ๋˜ ๋ฌด์—‡์ผ๊นŒ? ssh-agent๊ฐ€ ๋™์ž‘์„ ํ•˜๊ณ  ์žˆ์ง€ ์•Š๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. ์ด ๋ฌธ์ œ๋Š” ์•„๋ž˜์˜ ์ปค๋งจ๋“œ๋กœ ํ•ด๊ฒฐ ๊ฐ€๋Šฅํ•˜๋‹ค.

eval $(ssh-agent)

์•ž์„œ ์–ธ๊ธ‰ํ–ˆ๋“ฏ ์œ„์˜ ์ปค๋งจ๋“œ๋„ Git Bash์—์„œ ์ž…๋ ฅํ–ˆ๋‹ค.

์š”๋ ‡๊ฒŒ ์ƒ๊ฒผ์Œ

์ด๋ ‡๊ฒŒ Agent์˜ pid๊ฐ€ ์ž˜ ์ถœ๋ ฅ์ด ๋˜์—ˆ๋‹ค๋ฉด ์ด์ œ ๋‹ค์‹œ ํ•œ๋ฒˆ ssh-add ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰์‹œ์ผœ๋ณด์ž. ์•„๋ž˜์˜ ๋ชจ์Šต์ด ๋ณด์˜€๋‹ค๋ฉด ์„ฑ๊ณต์ด๋‹ค.

Identity added: ~/.ssh/id_rsa

๊ณ„์† ๋ฐ˜๋ณต๋˜์–ด ๋‚˜ํƒ€๋‚œ ๋ฌผ๊ฒฐํ‘œ์‹œ(~)๋Š” home๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๊ฐ€๋ ค์„œ ํ‘œํ˜„ํ•œ ๊ฒƒ์ด๊ณ , ์ผ๋ฐ˜์ ์ธ ํ‘œ๊ธฐ๋ฒ•์ด๋‹ˆ ์ฐธ๊ณ ํ•˜๊ธธ ๋ฐ”๋ž€๋‹ค. ๊ทธ๋Ÿผ ๋ฌธ์ œ ํ•ด๊ฒฐ์— ๋„์›€์ด ๋˜์—ˆ๊ธฐ๋ฅผ ๋ฐ”๋ผ๋ฉฐ.

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€