git/list[1] front-page[2] threads[3] people[4] search[5] about
 

How to push using SSH and pull using HTTPS for all repos on GitHub?

From
JWJeffrey Walton <noloader@gmail.com>
Date
Aug 4, 2018, 23:16 UTC
Message-ID
<CAH8yC8mXaNDmLBpDmtVTP+6Yc8_fCz8YCadOL41fOvb2J6j=8Q@mail.gmail.com>

I'm having trouble setting up my ~/.gitconfig to push using SSH and pull using HTTPS for all repos on GitHub. The idea is, no passwords on pulls and only use the password for push.

I've got the first part of the equation using the following in my ~/.gitconfig (the ellipses are user info):

   $ cat ~/.gitconfig
   ...
   # Enforce SSH
   [url "ssh://git@github.com/"]
       insteadOf = https://github.com/
   [push]
      default = current

The above pushes and pulls using SSH. Pulls only need HTTPS so I tried adding the following which does not work as expected:

    [pull "https://github.com/"]
I've found several ways to break Git when trying to setup the HTTPS pull.
My question is, how do I setup the HTTPS pull in my ~/.gitconfig?
Thanks in advance.
Next: Jonathan Nieder
Message 1 of 4 in “How to push using SSH and pull using HTTPS for all repos on GitHub?”
  1. Jeffrey WaltonAug 4, 2018
  2. Jonathan NiederAug 5, 2018
  3. Jeffrey WaltonAug 5, 2018
  4. Jonathan NiederAug 5, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.