将git存储库添加到VSP上的现有文件夹 [英] Add git repository to existing folder on VSP

查看:165
本文介绍了将git存储库添加到VSP上的现有文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的安装程序如下所示:

我的根目录中的裸回购 / srv 文件夹



本地回购在我的PC上


$ b Gitlab回购 Gitlab



我添加了两个来源(Gitlab和我的裸回购),以将所有更改从本地计算机推送到源代码。
现在我想在我的 Bare Repo 中设置一个post-receive Hook,因此它会更新我的VSP上的工作目录( Bare Repo

但是我之前已经开发出没有git(所有的文件都是一样的),我不想在另一个目录中克隆Repo,只是将 .git 文件夹添加到我的 var / www / project

这可能与git?

或者有没有干净的方法克隆Repo和更改文件夹?

解决方案


我不想在其他目录中克隆回购,b ut只是将.git文件夹添加到我的var / www / project中。

通常,您使用 post-receive 钩子设置在裸仓库中,以将所述仓库结帐到目的地文件夹中:

  git --git-dir = /path/to/project_root/.git --work-tree = / var / www / project / checkout -f 


My Setup looks like this:

Bare Repo in my Root /srv Folder

Local Repo on my PC

Gitlab Repo on well Gitlab

I added two origins (Gitlab and my Bare Repo) to push all changes from my local machine to the source.
Now I want to set up a post-receive Hook in my Bare Repo so it will update the working directory on my VSP (where the Bare Repo lies)

But I already developed before without git (all the files are the same), I don´t want to clone the Repo in another directory, but just add the .git Folder to my var/www/project.
Is that possible with git?
Or is there no clean way around cloning the Repo and change folders?

解决方案

I don´t want to clone the Repo in annother directory, but just add the .git Folder to my var/www/project

Usually, you use the post-receive hook set in the bare repo to checkout said repo into the destination folder:

git --git-dir=/path/to/project_root/.git --work-tree=/var/www/project/ checkout -f

这篇关于将git存储库添加到VSP上的现有文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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