git 在没有 SSH 访问的情况下在防火墙后面使用 GitHub
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5093558/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using GitHub behind a firewall without SSH access
提问by Andres
I really want to use GitHub, but my company has everything locked down. Now, I can only use Tortoise SVN through the HTTP protocol. Can I use GitHub the same way? If so, how?
我真的很想使用 GitHub,但我的公司已经锁定了一切。现在,我只能通过 HTTP 协议使用 Tortoise SVN。我可以用同样的方式使用 GitHub 吗?如果是这样,如何?
回答by Mark Longair
I think you've always been able to clone githubrepositories over HTTP, but with the restriction that you couldn't push back to them. However, github have recently introduced the Smart HTTP transport, so now you can also push over HTTPS. This should work fine from behind any firewall. There's more on the Smart HTTP support in this blog post:
我认为你总是能够通过 HTTP克隆github存储库,但有你不能推回它们的限制。但是,github 最近引入了 Smart HTTP 传输,因此现在您也可以通过 HTTPS 进行推送。这应该可以在任何防火墙后面正常工作。这篇博文中有更多关于智能 HTTP 支持的信息:
To give a short summary - if you click the HTTP button on the "Source" tab of a repository, it'll give you a URL like:
给出一个简短的摘要 - 如果您单击存储库的“源”选项卡上的 HTTP 按钮,它将为您提供一个 URL,如:
If you clone with that URL, it'll prompt you for your github password whenever you need to communicate with the server (e.g. with git clone
, git fetch
, git push
, etc.) However, you can also clone using a URL like:
如果您使用该 URL 进行克隆,则只要您需要与服务器通信(例如git clone
,使用git fetch
、git push
、 等),它就会提示您输入 github 密码。但是,您也可以使用以下 URL 进行克隆:
... and you won't need to re-enter your password. (As that blog post mentions, make sure you've got https://
at the start of the URL, and be aware that this means that your github password will be stored in plaintext in your git config, so don't let anyone copy your .git
directory!)
...您无需重新输入密码。(正如那篇博文所提到的,确保您https://
在 URL 的开头,并注意这意味着您的 github 密码将以明文形式存储在您的 git 配置中,所以不要让任何人复制您的.git
目录! )
回答by gahooa
According to https://github.com/blog/92-http-cloning, you can clone from github over http.
根据https://github.com/blog/92-http-cloning,您可以通过 http 从 github 克隆。
Another post in this thread gives a good pointer on pushing.
此线程中的另一篇文章提供了有关推送的好指示。