本文介绍了Git serve:我想这很简单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何简单地通过http =发布,就像的hg serve !在Windows /工作箱上执行以下操作:

  git serve 

然后在Linux上的SIMPLY箱子去:

  git clone http ://项目项目

完成。

解决方案

导航到您的项目并使用以下开关启动git-daemon:

  cd项目
git守护进程--reuseaddr --base-path =。 --export-all --verbose

这会告诉git-daemon提供当前的所有项目目录(我假设它是包含.git /文件夹的项目目录)。它还告诉它重新使用相同的地址,如果你关闭它并启动备份太快。

您可以将它放入批处理脚本,并带有一个易于记忆的名称,例如gitserve,因此您不必再次输入全部内容。正如一些评论中所建议的那样,在最近的Git版本中,您可以:

  [别名] 
serve =!git daemon --reuseaddr --verbose --base路径=。 --export-all ./.git

一旦在服务器(您的Windows机器)上完成,你可以这样做:

  git serve 

git-daemon使用git://协议进行传输,所以在客户端(您的Linux机器)上,您需要执行以下操作:

  git clone git://123.456.789.111/ project 


I want to know how to simply publish over http = much like Mercurial's hg serve! On the Windows/work box do this:

git serve 

and then on the Linux box SIMPLY go:

git clone http://project project 

finished.

解决方案

Navigate into your project and start git-daemon with the following switches:

cd project
git daemon --reuseaddr --base-path=. --export-all --verbose

This tells git-daemon to serve up all projects inside the current directory (which I assume is the project directory containing the .git/ folder). It also tells it to re-use the same address if you shut it down and start it back up too fast.

You can put this into a batch script with an easy to remember name like "gitserve", so you don't need to type it all out again. As suggested in some of the comments, in recent versions of Git you can add an alias to the Git config:

[alias]
    serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git

Once that's done on the server (your Windows box), you can do:

git serve

git-daemon uses the git:// protocol for transport, so on the client (your Linux box), you would need to do:

git clone git://123.456.789.111/ project

这篇关于Git serve:我想这很简单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 22:50