Skip to content
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

Add support for http proxy_friendly_github_urls #215

Closed
wants to merge 1 commit into from
Closed

Add support for http proxy_friendly_github_urls #215

wants to merge 1 commit into from

Conversation

sebmaynard
Copy link

Provide proxy_friendly_github_urls=true on the command line to get all
dependency git://github.com urls transformed into https://github.com
so that they work behind a restrictive corporate firewall

Provide proxy_friendly_github_urls=true on the command line to get all
dependency git://github.com urls transformed into https://github.com
so that they work behind a restrictive corporate firewall
@ghost
Copy link

ghost commented Apr 19, 2012

Thanks, but we already have support for this:
Add the alternative url to rebar.config and run rebar get-deps alt_urls=true.

@ghost ghost closed this Apr 19, 2012
@sebmaynard
Copy link
Author

That's not quite the same - when I pull a module that has dependencies
(like my app depends on cowboy; cowboy depends on proper) I don't
really want to have to go and manually edit the freshly pulled cowboy
rebar.config and then run get-deps again (which would fail anyway, as
the deps/proper folder would be created, but nothing in it; so
get-deps aborts)

@ghost ghost reopened this Apr 19, 2012
@ghost
Copy link

ghost commented Apr 19, 2012

I see, that wasn't clear from the description.
The problem with this approach is that it special-cases github urls.
Not all git repos will be mappable to http(s) the same way.
Also, what about bzr and svn?

A list of patterns to match and replace in rebar_deps.erl maybe?

replacement_urls() ->
    [{git, "git://github.com", "https://github.com"}, ...].
-type replacement() :: {vcs(), native_url(), proxy_friendly_url()}
-type vcs() :: 'git' | 'hg' | 'bzr' | 'svn'.
-type native_url() :: string().
-type proxy_friendly_url() :: string().

@nox
Copy link
Contributor

nox commented May 5, 2012

You actually doesn't need anything for this except a recent version of git and these bits of config:

[url "https://github.com/"]
  insteadOf = "git://github.com/"
  pushInsteadOf = "git@github.com:"

The pushInsteadOf is obviously not actually required just to pull deps.

See git-config(1) for further details.

@nox
Copy link
Contributor

nox commented May 8, 2012

It may not be obvious from my previous comment but this url config must be in ~/.gitconfig to be useful when cloning.

With this, Rebar does not need anything to rewrite repos' URLs, at least with Git.

@aschepis
Copy link
Contributor

aschepis commented May 8, 2012

@nox wow thanks, i didnt know that. @Tuncer -- Do you think we should pull out my recent change and instead put some more helpful information about how to do this or do you think that alt_url is still useful?

@ghost
Copy link

ghost commented May 8, 2012

@aschepis maybe we should do that. We can also rely on file:script support like yaws does to
support unconventional use cases. @dizzyd @joewilliams @doubleyou?

@sebmaynard
Copy link
Author

@nox wow that's brilliant; had no idea there was already support for that in git. My 2 cents then - close this pull request as what I'd written (and extensions I was considering writing) are (in my mind) no longer necessary.

edit: Looking at it some more, with file:script everything that alt_url was for should be possible without needing alt_url, so I think that can be removed too.

@nox
Copy link
Contributor

nox commented May 13, 2012

If you never want to use anything other than HTTPS on GitHub again, you need two config sections:

[url "https://github.com/"]
  insteadOf = "git://github.com/"
[url "https://github.com/"]
  insteadOf = "git@github.com:"
  pushInsteadOf = "git@github.com:"

@technomancy
Copy link

Git's insteadOf behaviour is really handy for some things, but as far as I can tell it's not appropriate for internal mirroring since it doesn't support wildcards. For instance, I can't say something like "redirect all https://github.com/*/$REPO operations to git@internal.mirror:$REPO since the repositories on GitHub are scoped by user, while the internal mirror is flat.

Anyway, I'd like to see transparent support for mirrors if possible, hopefully in a way that isn't hard-coded to GitHub. I noticed this used to sorta be supported with the alt_urls feature, but this was removed a while back. The commit message for the removal states that it was removed "in favor of new features" but doesn't mention what these new features are. Maybe there's something I'm missing that could provide what I'm looking for?

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants