Git通过ngrok隧道转发 [英] Git over ngrok tunnel forwarding

查看:124
本文介绍了Git通过ngrok隧道转发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地实例上有一个git repo。我想从我的家庭网络之外访问这个。我应该在本地实例上创建一个git服务器和ssh服务器吗?另外我应该使用ngrok隧道的端口是什么。



任何输入都将不胜感激。

issue 193 或 issue 145 ,以及 ngrok用法,你可以通过认证( authtoken )直接暴露你的ssh端口(22)。


首先,你需要注册一个ngrok账户,去仪表板会得到一个令牌,然后像你这样的执行命令在你的linux服务器




  ./ ngrok -authtoken as80YQhzsxIIMkMFF8gI -proto = tcp 22 

$ p
$ b

在这种情况下,不需要git服务器,你可以直接克隆你的repo:

  git clone ssh://user@ip.of.local.host:/path/to/repo.git 

(' repo.git '因为你应该使用裸回购推回到



git的唯一gitserver是< git守护进程(与ssh无关) rel =nofollow noreferrer> git daemon p>

只有在Git前面有一个http服务器时,才会使用ngrok重定向http,使用智能http协议
在这种情况下,您可以配置Apache以调用 git-http-backend


I have a git repo on my local instance. I want to access this from outside my home network. Should I create a git server and ssh server on my local instance for this? Also what is the port I should tunnel using ngrok.

Any inputs are greatly appreciated.

解决方案

As illustrated in issue 193 or issue 145, and ngrok usage, you can directly expose your ssh port (22), with authencation (authtoken).

First, you need register a ngrok account, go to the dashboard will get a token, then execute command like this in you linux server

./ngrok -authtoken as80YQhzsxIIMkMFF8gI -proto=tcp 22

In that case, no git server would be needed, you could clone directly your repo with:

git clone ssh://user@ip.of.local.host:/path/to/repo.git

('repo.git' because you should use a bare repo to push back to)

The only git "server" which comes with git is the git daemon (nothing to do with ssh)

You would use ngrok to redirect http only if you had an http server in front of your Git, using the smart http protocol.
In that case, you could configure Apache to call git-http-backend.

这篇关于Git通过ngrok隧道转发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆