将 git 存储库添加到 VSP 上的现有文件夹 [英] Add git repository to existing folder on VSP
问题描述
我的设置如下所示:
Bare Repo 在我的根 /srv
文件夹中
Bare Repo in my Root /srv
Folder
本地回购在我的电脑上
Gitlab 回购 很好 Gitlab
我添加了两个源(Gitlab 和我的 Bare Repo)以将所有更改从我的本地计算机推送到源.
现在我想在我的 Bare Repo 中设置一个 post-receive Hook,以便更新我的 VSP 上的工作目录(Bare Repo 所在的位置)
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)
但我之前已经在没有 git 的情况下开发过(所有文件都相同),我不想将 Repo 克隆到另一个目录中,而只需将 .git
文件夹添加到我的 var/www/project
.
用 git 可以吗?
还是没有干净的方法来克隆 Repo 和更改文件夹?
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?
推荐答案
我不想在另一个目录中克隆 Repo,只需将 .git 文件夹添加到我的 var/www/project 中
I don´t want to clone the Repo in annother directory, but just add the .git Folder to my var/www/project
通常,您使用 post-receive
hook 在裸仓库中设置以将所述仓库签出到目标文件夹中:
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屋!