0

I have read Configuring Git over SSH to login once. Muein Muzamil's answer says that to use SSH, we must configure as follows:

remote.origin.url=git@github.com:your_username/your_project.git

Which is to say, that in a normal Windows PowerShell, SSH does not work with HTTPS.

GitHub for Windows comes with the Git Shell. It's a souped-up PowerShell with some fancy features, including the ability to use SSH with HTTP. I know this because I just ran git push without needing to authenticate, and then ran git config -l to see that I am using HTTPS as the remote origin url.

Why does a normal Windows PowerShell require the git@github.com protocol whereas a Git Shell does not?

Community
  • 1
  • 1
Shaun Luttin
  • 133,272
  • 81
  • 405
  • 467

1 Answers1

2

Windows PowerShell, SSH does not work with HTTPS

That doesn't make sense: you are using ssh or you are using https (http with ssl). One "does not work with" the other.

G4W (GitHub for Windows) has your GitHub account credentials, so it can use an https url.

A regular Git shell from msysgit/Git for Windows can use https or ssh, BUT for ssh, you need to make sure that:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • "G4W... has your GitHub account credentails, so it can use ... HTTPS." That answers my question. – Shaun Luttin Oct 10 '14 at 20:59
  • A follow up question (that might belong in its own SO question): *Why does GitHub for Windows (G4W) create an SSH key?* After installation, there is an `~\.ssh\github_rsa` key and its `.pub`. Does G4W ever use this or does it instead always use HTTPS? My own sense is that GFW uses the SSH key when it's communicating over the `git@github.com` protocol and using the username and password otherwise, and that we can manually control this using `git remote set-url origin ` command. – Shaun Luttin Oct 10 '14 at 21:02
  • What you are thinking is probably right but `git@github.com` is not an protocol, ssh is. Git creates the ssh key to authenticate over ssh. After authenticating you can push/pull. – Dennis van der Schagt Oct 10 '14 at 23:42
  • @ShaunLuttin that is a good separate question. I will look it up. – VonC Oct 11 '14 at 04:11
  • @VonC I look forward to your answer. – Shaun Luttin Oct 11 '14 at 16:57
  • @ShaunLuttin I would need a new question, for me to post a new answer ;) – VonC Oct 12 '14 at 04:44