4

I have read some questions around but still didn't found the solution to this problem

I have git on windows and I want to connect to github using ssh. Following this tutorial https://help.github.com/articles/generating-ssh-keys I have successfully setup my keys

If I open a git-bash and try to ssh github I am able to connect, so this works

ssh -T git@github.com
Hi username! You've successfully authenticated, but GitHub does not
provide shell access.

this means that git-bash actually sees my keys. However if I try to do a push

git push origin master

git prompts me for username and password
Thank you for your help

EDIT: solved by using the git protocol instead of the http protocol, my fault
so replace this

https://github.com/_user_/_repository_.git  

whit this

git@github.com:_user_/_repository_.git  

in the remote link

mottalrd
  • 4,390
  • 5
  • 25
  • 31

2 Answers2

5

No need to remove/add, just do something like this:

git remote set-url origin git@github.com:username/repo.git
dahlbyk
  • 75,175
  • 8
  • 100
  • 122
2

You probably cloned a remote that uses the https protocol, rather than the git protocol. You need to redefine your remote for origin.

# Change this as needed.
github_username="$LOGNAME"

# Replace your remote, then push.
git remote rm origin
git remote add origin "git@github.com:${github_username}/${PWD##*/}.git"
git push --tags --set-upstream origin master
Todd A. Jacobs
  • 81,402
  • 15
  • 141
  • 199