如何克隆远程linux服务器上存在的git仓库到windows中 [英] How to clone a git repository which is present on a remote linux server into windows

查看:283
本文介绍了如何克隆远程linux服务器上存在的git仓库到windows中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在远程服务器XXX.XXX.XXX.XXX上安装了git存储库,并且想在我的Windows环境中克隆它。它实际上是一个webapp,位于 / var / www / html / Testsite 下。 git仓库是在 Testsite 文件夹内创建的。



我希望命令:

git clone http:// XXX。 XX.XX.XX / Testsite / mysite.git 可以正常工作,但事实并非如此。请让我知道如何获取URL并将其克隆到我的环境中。

但是,通过本地文件夹,我可以轻松地克隆存储库工作完全正常。



非常感谢。

解决方案

't,没有配置你的Apache为了服务器git请求。



事实上,你的 mysite.git 是在> Testsite 内不会让它可以被git访问。 这个配置,你可以在单独的VirtualHost中定义(所以在单独的端口,因为您已经在 Testing >上使用端口80/443),以便调用能够解释git克隆请求的git脚本:

  ScriptAlias / hgit / / path / to / git / libexec / git-core / git-http-backend / 
SetEnv GIT_HTTP_BACKEND/ path / to / git / libexec / git-core / git -http-backend
< Location / hgit>
...
< / Location>






至于ssh,正确的url是:

  git clone ssh://account@XX.XX.XX.XX/var/www/html/Testsite/mysite。 git 

只有当您生成一个公共和私有(最初不受密码保护),并将公钥发布到〜account / .ssh / authorized_keys

或者服务器上的sshd(ssh守护进程)不会识别你(因此是密码请求),并且不知道 Testing / 是。


I have a git repository setup on a remote server XXX.XXX.XXX.XXX and want to clone the same in my windows environment. It's actually a webapp present under /var/www/html/Testsite. The git repo is created inside the Testsite folder.

I was hoping the command:

git clone http://XXX.XX.XX.XX/Testsite/mysite.git would work fine but it does not. Please let me know how I can get the URL to configure and clone it into my environment.

However, with the local folder, I am easily able to clone the repository which works totally fine.

Thanks a lot.

解决方案

You can't, without configuring your Apache in order to server git request.

The fact that your mysite.git is within Testsite doesn't make it accessible to git.

As shown in this config, you can define in a separate VirtualHost (so in a separate port, since you are already using port 80/443 on Testing) a config in order to call the git script able to interpret a git clone request:

ScriptAlias /hgit/ /path/to/git/libexec/git-core/git-http-backend/
SetEnv GIT_HTTP_BACKEND "/path/to/git/libexec/git-core/git-http-backend"
<Location /hgit>
   ...
</Location>


As for ssh, the right url would be:

git clone ssh://account@XX.XX.XX.XX/var/www/html/Testsite/mysite.git 

And it would work only if you generate a public and private (non-passhrase protected at first), and publish the public key in the ~account/.ssh/authorized_keys.
Or the sshd (ssh daemon) on the server won't recognize you (hence the password request), and won't know where "Testing/" is.

这篇关于如何克隆远程linux服务器上存在的git仓库到windows中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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