-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Set fork remotes using ssh instead of https #563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I'm good with this. |
|
This will make it less of a hassle for people who have ssh set up, but it will be a problem for those who haven't. So this is actually a breakage for http users. The forking works, but cloning doesn't. An alternative would be to use ssh if the argument to Either way, I'm not positive to this particular change. |
|
@nicolaiskogheim Fair enough, is this something you want me to work on then or are you not bothered? I assume most people would use the shorthand The flag would work but seems kind of annoying to have to type every time. What do you reckon? |
|
I just got an idea. We could run something like Be sure to test it in an environment where ssh access isn't configured. I tend to pull out Vagrant for stuff like that. If the user doesn't use ssh with github, we wouldn't want to add github to You might get something like The authenticity of host 'github.com (192.30.252.1)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?from ssh, but to avoid that you can do (and redirect all output while we're at it): yes no | ssh -T [email protected] >/dev/null 2>&1There probably is a flag you can pass to ssh instead of the
Yes :) |
|
Nice, I like it. I'll have a play tomorrow. |
|
@qw3rtman @nicolaiskogheim Ok, I've updated this to check if we can login via ssh, if we can, ssh remotes are used, if not it falls back to https. I've added the exit command to ssh and check for both 0 and 1 exit codes in bash so that if (for whatever reason) GitHub ever allow interactive ssh sessions in the future this will still work and won't hang the terminal. The only caveat is that if the user has ssh set up for GitHub but they're on a new machine and don't have github.com in I've done this on purpose, we could actually bypass Also updated docs to reflect the new behaviour. |
|
Just a thought, I could remove |
| ## git line-summary | ||
|
|
||
| WARNING: git line-summary has been replaced by git summary --line and will be removed in a future release. | ||
| WARNING: git line-summary has been replaced by git summary --line and will be removed in a future release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, looks like atom removed a load of unnecessary white space when I saved. Happy to split this out into a separate commit (or just remove it) if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine.
|
Looks great. I gave it a test run with and without ssh configured, and it worked as I expected. |
|
Sweet, my lunch break is over now but I'll get that updated when I get home 👍 |
My guess is that if github.com isn't in known_hosts, then they probably haven't configured ssh with github.com either, and a silent fail is appropriate. |
|
This should be all sorted now 🎉 |
| 2. rename the `origin` remote repo to `upstream` | ||
| 3. adds the forked repo as a remote called `origin` | ||
|
|
||
| Remotes will use ssh if you have it configured with GitHub, if not, https will be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change this to:
The ssh remote will be used if you have used an ssh remote with GitHub in the past. Otherwise, the https remote will be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you have used an ssh remote with GitHub in the past
This isn't necessarily accurate.
I'm fine with the way it is.
|
I think it looks great except for the one stylistic suggestion I made. @nicolaiskogheim, thoughts? Also, could you regenerate the documentation pages (see this)? |
|
I thought I did regenerate the docs in f22d7bc, or is something wrong? It's late here and I'm tucked up in bed, I'll update the man page tomorrow morning 👍 |
|
No worries. It seems like |
|
The html file is missing :) Otherwise, LGTM. EDIT: Forgot to refresh the tab. Didn't see your comment there @qw3rtman :) EDIT 2: There was more comments that I didn't see. Reading up now. |
|
I wrote that last comment on an old version this page. Apart from the missing |
|
Had to delete Should be sorted now ✨ |
|
Thanks, @lukechilds! |
Proposed in #540
This allows you to push changes to your fork without being prompted for your GitHub credentials every time.
Previous behaviour:
New behaviour: