简体   繁体   English

如何在家庭网络上访问git repo?

[英]How do I reach a git repo on my home network?

I have a raspberry pi that I want to use to host my git repos. 我有一个覆盆子pi,我想用来托管我的git回购。 I have created a host on no-ip.org that just redirects to my router and I setup port forwarding on my router to redirect a certain port to my pi. 我在no-ip.org上创建了一个主机,该主机仅重定向到我的路由器,并且在路由器上设置了端口转发以将某个端口重定向到我的pi。 I can ssh into my pi using this host name and port (I think I had to change the ssh daemon on my pi to not use the standard port 22). 我可以使用此主机名和端口ssh进入pi(我认为我必须更改pi上的ssh守护程序才能不使用标准端口22)。

So now I want to know what url would I use for my git remote to access a git repo on my pi if it is located at ~/repos/myrepo.git. 所以现在我想知道如果我的git远程目录位于〜/ repos / myrepo.git,我将使用什么url来访问pi上的git repo。 I have tried http://my-url/~/repos/myrepo.git but that doesn't work. 我试过http://my-url/~/repos/myrepo.git,但这不起作用。 I've also just tried the pi's IP address and the absolute path to the repo, such as //192.168.1.3/home/david/repos/myrepo.git but that also does not work. 我也刚刚尝试了pi的IP地址和回购协议的绝对路径,例如//192.168.1.3/home/david/repos/myrepo.git,但这也不起作用。

I'd like to be able to access my repos using the no-ip host I created so that I can access them from anywhere, but I'll settle for using the local IP if I have to. 我希望能够使用我创建的no-ip主机访问我的存储库,以便可以从任何地方访问它们,但是如果需要的话,我会选择使用本地IP。 Oh, I'm trying to access my pi from a Windows box if that matters. 哦,如果重要的话,我正试图从Windows机顶盒访问我的pi。

Thanks to njzk2 for telling me to RTFM I was able to figured it out. 感谢njzk2告诉我RTFM,我得以弄清楚。 I went with the SSH protocol and had to use the format david@my-url:~/repos/myrepo.git and that worked. 我使用SSH协议,不得不使用david @ my-url:〜/ repos / myrepo.git格式,并且可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM