-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Allow cloning over https instead of ssh #149
Conversation
Labeled as both enhancement and bug because supporting URLs for It's probably not too hard to fix though. |
As a data point, I like the current behavior. |
I'd be fine with a git-config option to indicate I want to use https. That should satisfy both Jakub's use case and mine. |
James McCoy, el 17 de September a las 04:38 me escribiste:
Haha, but I think that's terribly counter-intuitive. Really, you type For me that's the worse case scenario... I would be willing to make it I think is reasonable to ask the user to do one more click to copy the |
Relabeling as bug-only, as other types of URLs are supported via the config option |
Some very half baked support to use full GitHub clone URLs was added to clone at some point, but this support is insuficient. It completely ignores the URL itself so it will always clone using the current `hub.urltype` scheme (which defaults to `ssh_url` and is probably too obscure to ask the user to manually change it). This commit makes the clone command to parse the URLs more intelligently and set the `hub.urltype` config option as appropriate (it seems more reasonable to think the user will like to use that instead, not only for the cloning but also for other future operations, like pushing). Fixes sociomantic-tsunami#149.
Some very half baked support to use full GitHub clone URLs was added to clone at some point, but this support is insuficient. It completely ignores the URL itself so it will always clone using the current `hub.urltype` scheme (which defaults to `ssh_url` and is probably too obscure to ask the user to manually change it). This commit makes the clone command to parse the URLs more intelligently and set the `hub.urltype` config option as appropriate (it seems more reasonable to think the user will like to use that instead, not only for the cloning but also for other future operations, like pushing). Fixes sociomantic-tsunami#149.
Some very half baked support to use full GitHub clone URLs was added to clone at some point, but this support is insuficient. It completely ignores the URL itself so it will always clone using the current `hub.urltype` scheme (which defaults to `ssh_url` and is probably too obscure to ask the user to manually change it). This commit makes the clone command to parse the URLs more intelligently and set the `hub.urltype` config option as appropriate (it seems more reasonable to think the user will like to use that instead, not only for the cloning but also for other future operations, like pushing). Fixes sociomantic-tsunami#149.
Fix attached. @gkotian sorry for kind of destroying what you did in #160. 👼 @andrej-mitrovic-sociomantic I made this PR using my master branch so I can test #136 fix 💃 @jwilk I didn't include a way to force a URL type in this PR, I consider that a different issue (an enhancement). I'd be OK to add something like |
BTW, also UNTESTED. Help testing this is very much appreciated. |
Some very half baked support to use full GitHub clone URLs was added to clone at some point, but this support is insuficient. It completely ignores the URL itself so it will always clone using the current `hub.urltype` scheme (which defaults to `ssh_url` and is probably too obscure to ask the user to manually change it). This commit makes the clone command to parse the URLs more intelligently and set the `hub.urltype` config option as appropriate (it seems more reasonable to think the user will like to use that instead, not only for the cloning but also for other future operations, like pushing). Fixes sociomantic-tsunami#149.
I'd like to test at least:
|
Typo: I would have never thought that https://github.com/owner/repo has anything to do with SVN. It works with I'm getting 404 when trying to clone my own repos, regardless of URL type:
I don't see any point in command-line option for forcing URL type. |
Some very half baked support to use full GitHub clone URLs was added to clone at some point, but this support is insuficient. It completely ignores the URL itself so it will always clone using the current `hub.urltype` scheme (which defaults to `ssh_url` and is probably too obscure to ask the user to manually change it). This commit makes the clone command to parse the URLs more intelligently and set the `hub.urltype` config option as appropriate (it seems more reasonable to think the user will like to use that instead, not only for the cloning but also for other future operations, like pushing). Fixes sociomantic-tsunami#149.
Arrrgh! Hopefully fixed. Thanks for the testing! About SVN, OK, then I can simplify even further the heuristics to select the correct url type. Much better (and no mention to SVN in a git subcommand :D). diff --git a/git-hub b/git-hub
index dc7a19d..464c7be 100755
--- a/git-hub
+++ b/git-hub
@@ -792,18 +792,12 @@ class CloneCmd (object):
urltype = config.urltype
if repo.endswith('.git'):
repo = repo[:-4] # remove suffix
- if repo.startswith('https://'):
- urltype = 'clone_url' # how GitHub calls HTTP
- elif repo.startswith('git:'):
- urltype = 'git_url'
- elif ':' in repo:
- urltype = 'ssh_url'
- elif repo.startswith('https://'): # and it doesn't end with .git
- warnf("{} looks like a SVN URL, which doesn't make a "
- "lot of sense to use with git, we'll "
- "use the current the config option "
- "hub.urltype ({}) instead.",
- repo, urltype)
+ if repo.startswith('https://'):
+ urltype = 'clone_url' # how GitHub calls HTTP
+ elif repo.startswith('git:'):
+ urltype = 'git_url'
+ elif ':' in repo:
+ urltype = 'ssh_url'
# At this point we need to have an urltype
if urltype is None:
die("Can't infer a urltype and can't find the config "
@@ -821,7 +815,7 @@ class CloneCmd (object):
def setup_repo(cls, proj):
# Own repo
if proj.split('/')[0] == config.username:
- repo = req.get('/repos/%s/%s' % (config.username, proj))
+ repo = req.get('/repos/' + proj)
if repo['fork']:
upstream = repo['parent']['full_name']
else: |
Some basic testing for own repos seems to work fine. |
Now it looks good to me. |
Some very half baked support to use full GitHub clone URLs was added to clone at some point, but this support is insuficient. It completely ignores the URL itself so it will always clone using the current `hub.urltype` scheme (which defaults to `ssh_url` and is probably too obscure to ask the user to manually change it). This commit makes the clone command to parse the URLs more intelligently and set the `hub.urltype` config option as appropriate (it seems more reasonable to think the user will like to use that instead, not only for the cloning but also for other future operations, like pushing). Fixes sociomantic-tsunami#149.
Merge, please? Maybe? |
LGTM. |
OK, auto-merging as it seems like @mihails-strasuns-sociomantic is taking a nap 😝 |
BTW, I rebased this using #136 and it worked fine. |
If I try
git hub clone https://github.com/author/repo
then git-hub unhelpfully changes that togit@github.com:author/repo
. The entire reason I used an https URL is because I want to use it instead of ssh. In fact, I have to because ssh is blocked in this environment.