[github] Share Project: fix github host url for Enterprise. IDEA-101424

Instead of always using https://github.com,
use the host defined in the settings.
This commit is contained in:
Kirill Likhodedov
2013-02-19 20:07:06 +04:00
parent 5a9e922953
commit 6fefd85d74
2 changed files with 11 additions and 1 deletions
@@ -119,6 +119,16 @@ public class GithubApiUtil {
return "https://" + getApiUrlWithoutProtocol(urlFromSettings);
}
/**
* Returns the "host" part of Git URLs.
* E.g.: https://github.com
* Note: there is no trailing slash in the returned url.
*/
@NotNull
public static String getGitHost() {
return "https://" + removeTrailingSlash(removeProtocolPrefix(GithubSettings.getInstance().getHost()));
}
/*
All API access is over HTTPS, and accessed from the api.github.com domain
(or through yourdomain.com/api/v3/ for enterprise).
@@ -218,7 +218,7 @@ public class GithubShareAction extends DumbAwareAction {
final GitSimpleHandler addRemoteHandler = new GitSimpleHandler(project, root, GitCommand.REMOTE);
addRemoteHandler.setNoSSH(true);
addRemoteHandler.setSilent(true);
final String remoteUrl = "https://github.com/" + login + "/" + name + ".git";
final String remoteUrl = GithubApiUtil.getGitHost() + "/" + login + "/" + name + ".git";
addRemoteHandler.addParameters("add", "origin", remoteUrl);
try {
addRemoteHandler.run();