git-extras
git-extras copied to clipboard
Any way to persist Github username and password to avoid prompt for git fork?
I don't want to enter it for every repository I want to fork. This seems to be the only command that contacts Github.com[1]. Would or could this read a .gitconfig file? I might actually like this separate, as I have both a private and public use for git tools on the same computer.
Maybe use some environment variable like GITHUB_USER_NAME or GITHUB_PASSWORD, which is simpier.
@Pysis868 Have you tried github's hub? I've only tested it just now but it looks like it remembers credentials.
Hub is much like git-extras, and they actually have some of the same helper commands as we do, only you write hub <command>, so you can have both installed without getting conflicting commands.
@nicolaiskogheim Couldn't you bypass the login prompt by setting the remotes using ssh rather than https? Then the ssh key will be used for auth in the background without any user interaction needed.
Happy to submit a PR for this, or is there a reason it uses https instead of ssh?
@lukechilds, AFAIK the SSH key can't be used to fork a repository on the remote as this would require authentication via the GitHub API.
One option that is possible would be creating a GitHub application and authenticating via the application (while storing the OAuth token); however, I'm not sure this is the right way to go about doing this in terms of security and usability.
@qw3rtman I think you may have misunderstood, I'm only proposing to use ssh for the remotes so you don't get prompted for each push, not the actual API request to do the fork.
See example in the referenced PR.
My bad! What you're saying makes sense. 👍
or is there a reason it uses https instead of ssh?
@lukechilds I answered in your PR :)
Okay, so we have solved something with #563, but the initial fork still requires username and password/token, which means this issue still isn't solved.
I would still strongly suggest people who want to deal with github to use github/hub, and I still would prefer that we didn't deal with github api's. But, if there is a strong interest in being able to use git fork without having to type passwords, we will reconsider it. Pull requests are welcomed. Just comment here if you want to contribute and we will nudge you in the right direction.
@nicolaiskogheim is there possibility to add flag for user (or maybe even password) so user can alias git fork. example:
git fork --user rachmadaniHaryono --password somerandom_password
that way user can alias it, without giving any prompt?
also is there a way to change origin branch's remote url to use git+ssh instead of https. right now i always do these commands after git fork (taken from this question http://stackoverflow.com/a/8588786/1766261)
git fork some-username/some-project
git remote set-url origin git+ssh://[email protected]/rachmadaniHaryono/some-project.git
git remote -v
is there any function/option/alias to do this directly with git fork?