Git:如何获取公共的只读git://URL [英] Git: how to get the public, read-only git:// URL
问题描述
我需要将我的http://github.com/user/project
作为git://URL提供,并且它必须是只读且公开的.我的http://github
存储库目前处于公开状态,但是我无法确定生成或获取我的git://URL.
I'm needing to give my http://github.com/user/project
as a git:// URL, and it needs to be read-only and public. My http://github
repo is public at the moment, but I can't figure out to generate or get my git:// URL.
感谢您的阅读. :)
Thank you for reading. :)
推荐答案
虽然简单地将https//
替换为git://
应该可以,但事实是git将使用端口9418进行通信(我在"使用ssh或git协议哪个更快?).
While simply replacing https//
by git://
should work, the fact is git will use the port 9418 to communicate (I mention it in "Which is faster, ssh or git protocol?").
该端口通常被阻止(如公司所阻止的" git://
协议中所示,该如何解决?),这就是为什么在GitHub GUI中仅显示https://
和ssh://
的原因.
That port is often blocked (as shown in "git://
protocol blocked by company, how can I get around that?"), which is why only https://
and ssh://
are shown in the GitHub GUI.
请注意,此要点说明了您可以从git://
推送,但可以推送(例如)具有 pushInsteadOf
配置设置的ssh://
:
Note that this gist illustrates that you could push from git://
, but push over (for instance) ssh://
with the pushInsteadOf
config setting:
您可以通过git://克隆所有内容,但告诉Git推送HTTPS.
You can clone everything over git://, but tell Git to push over HTTPS.
[url "https://github.com/"]
pushInsteadOf = git://github.com/
同样,如果您想通过git://或HTTPS进行克隆,但要通过SSH进行推送:
Likewise, if you want to clone over git:// or HTTPS, but push over SSH:
[url "git@github.com:"]
pushInsteadOf = git://github.com/
pushInsteadOf = https://github.com/
这篇关于Git:如何获取公共的只读git://URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!