-
-
Save taoyuan/bfa3ff87e4b5611b5cbe to your computer and use it in GitHub Desktop.
# npm using https for git | |
git config --global url."https://github.com/".insteadOf git@github.com: | |
git config --global url."https://".insteadOf git:// | |
# npm using git for https | |
git config --global url."git@github.com:".insteadOf https://github.com/ | |
git config --global url."git://".insteadOf https:// |
the inverse, forcing git to use ssh instead of https:
git config --global url."git@github.com:".insteadOf "https://github.com/"
did not work for me.
I needed to add another one to get it working with Node's NPM
git config --global url."https://github.com/".insteadOf ssh://git@github.com
This adds an ssh://
prefix and removes the :
suffix. It allows downloading public packages from GitHub repositories in environments like Docker where there are no SSH keys.
If anyone found themselves unable to revert the config using the suggested commands, go into the git config editor and manually delete what you want to remove :)
git config --global -e
For anyone unfamiliar with the editor, press "i" to start editing, "esc" to stop editing, and " : -> w -> q " to save and quit the editor.
@joseboretto
Bro, you saved me headache. Thanks.
Thank you!! You just saved my life.
All the yes. Thank you !
This worked like a charm 🥇
When using ssh (git config --global url."git@github.com:".insteadOf https://github.com), is there a way to authenticate (using A PAT)? I know it's possible with https, don't see a way to provide a PAT (via Github secret) when using SSH method.
the inverse, forcing git to use ssh instead of https: