Configuration Management/git

Git/Sourcetree - Permission Denied

건담아빠 2022. 10. 14. 19:44

 

GitHub Desktop을 사용하다가 Sourcetree를 설치하고 사용하려고 하니.. permission denied이 떠버렸다.. OTL.

 

ssh 인증서 확인

$ ssh -T git@github.com
    Enter passphrase for key '/Users/deokjoonkang/.ssh/id_ed25519': 
    Enter passphrase for key '/Users/deokjoonkang/.ssh/id_ed25519': 
    Enter passphrase for key '/Users/deokjoonkang/.ssh/id_ed25519': 
    git@github.com: Permission denied (publickey).

 

ssh ssh-agent에 등록

$ ssh-add ~/.ssh/id_ed25519
    Enter passphrase for /Users/deokjoonkang/.ssh/id_ed25519: 
    Identity added: /Users/deokjoonkang/.ssh/id_ed25519 (aaaa@naver.com)

 

ssh 접속 테스트

$ ssh -Tv git@github.com
    OpenSSH_8.6p1, LibreSSL 3.3.6
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
    ...
    Hi dchkang83! You've successfully authenticated, but GitHub does not provide shell access.
    debug1: channel 0: free: client-session, nchannels 1
    Transferred: sent 2164, received 2344 bytes, in 0.4 seconds
    Bytes per second: sent 5517.8, received 5976.7
    debug1: Exit status 1

성공했다...

 

ssh 인증키를 id_ed25519로 생성해서 sourcetree에서 못알아 먹엇는데 ssh-agent에 등록해줘서 된건가..

아니면 sourcetree는 원래부터 ssh-agent에 등록해 줘야 하는것이었을수도..!

암튼되니 패스.!

 

 

아.. 리붓하니까 또 안되네...? 된자앙..

https://dchkang83.tistory.com/60

 

Git/SSH keys 생성 및 등록

ssh key 생성 $ cd ~/.ssh $ ssh-keygen -t ed25519 -C "aaaaa@naver.com" Generating public/private ed25519 key pair. ... ssh key 복사 $ pbcopy ~/.ssh/id_ed25519 복사된 ssh key github에 추가 github..

dchkang83.tistory.com

위에 ssh key 생성은 문제 생기기 전에 생성한 방식인데 방법을 바꿔서 아래와 같이 생성한다.

 

ssh key 생성 + 복사 + ssh agent 재등록

깃에 키 등록 및 복사등은 'Git/SSH keys 생성 및 등록' 포스팅 참고

$ cd ~/.ssh

$ ssh-keygen -t rsa -b 4096 -C "dchkang83@naver.com"

$ pbcopy < ~/.ssh/id_rsa.pub

$ ssh -T git@github.com

$ ssh-add -K ~/.ssh/id_rsa

Sourtree 실행해도 되고 재부팅 이후에도 된다.. 더이상 문제가 없기를...!

 

참조)

https://community.atlassian.com/t5/Sourcetree-questions/How-can-I-use-my-existing-default-ssh-key-with-SourceTree/qaq-p/208184

 

How can I use my existing default ssh key with SourceTree?

I just rebuilt my laptop and iMac with clean installs of MacOS Sierra. I normally use the command line git client to work with GitHub or BitBucket. I'm on a new project where I have to collaborate with some people on Windows and suggested they use SourceTr

community.atlassian.com

https://www.microfocus.com/documentation/rsit-server-client-unix/8-4-0/unix-guide/ssh-add_options_ap.html

 

ssh-add Command Line Options - Reflection for Secure IT for UNIX

The syntax for ssh-add is: ssh-add [-c] [-d] [-D] [-h] [-l] [-L] [-p] [-t timeout] [-U] [-V] [file1 file2 ...] Use file1, file2... to specify keys to add to the agent. Specifying a key file is optional. If don't specify any key files, ssh-add adds all the

www.microfocus.com

https://docs.github.com/en/authentication/troubleshooting-ssh/error-ssh-add-illegal-option----k

 

Error: ssh-add: illegal option -- K - GitHub Docs

The -K option is in Apple's standard version of ssh-add, which stores the passphrase in your keychain for you when you add an ssh key to the ssh-agent. If you have installed a different version of ssh-add, it may lack support for -K. Solving the issue To a

docs.github.com