카테고리 없음

github. permission denied

ttoance 2024. 8. 18. 19:25

git@github.com: Permission denied (publickey) - Stack Overflow

 

git@github.com: Permission denied (publickey)

I created a new remote repository and tried to use git push -u origin master command to push my local files into the new repository the first time after I add it and commit it. However, it pops up ...

stackoverflow.com

 

1. Check SSH Key:

  1. Check Existing SSH Keys: Ensure that you have an existing SSH key. Run the following command to list your existing keys:Look for files named id_rsa or id_rsa.pub.
  2. ls -al ~/.ssh
  3. Generate a New SSH Key (If Needed): If you don't have an SSH key or want to generate a new one, you can use the following command:Follow the prompts to generate a new key. Make sure to replace "your_email@example.com" with your actual email address.
  4. ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  5. Add SSH Key to SSH Agent: Start the SSH agent and add your private key:
  6. eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa

2. Add SSH Key to GitHub:

  1. Copy the SSH Key to Clipboard: Use the following command to copy your SSH key to the clipboard:If the clip command is not available, you can open the id_rsa.pub file with a text editor and manually copy its contents.
  2. clip < ~/.ssh/id_rsa.pub
  3. Add SSH Key to GitHub:
    • Go to your GitHub account settings.
    • Navigate to "SSH and GPG keys" or "SSH keys."
    • Click on "New SSH key" or "Add SSH key."
    • Paste your key into the provided field and give it a title.

 

 

오랜만에, github 추가하려다가 push가 잘 안되어서 찾아보다가 발견한 해결책

반응형