GitHub: Permission denied (publickey). fatal: The remote end hung up unexpectedly

Viewed 323235

I have followed these instructions below to upload a project.

Global setup:

 Download and install Git
  git config --global user.name "Your Name"
  git config --global user.email tirenga@gmail.com
  Add your public key


Next steps:

  mkdir tirengarfio
  cd tirengarfio
  git init
  touch README
  git add README
  git commit -m 'first commit'
  git remote add origin git@github.com:tirenga/tirenga.git
  git push origin master

But I get this error:

Permission denied (publickey). fatal: The remote end hung up unexpectedly

22 Answers

You can try change your type connection to branch from ssh to https.

  1. nano project_path/.git/config
  2. Replace git@github.com:username/repository.git to https://username@github.com/username/repository_name.git
  3. Save file ctrl + o

After that you can try git pull without publickey

Use ubuntu on windows store

windows subsystem for linux

, your git push will work across different accounts.

Related