Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Git post update挂钩部署repo的/dist文件夹_Git_Deployment_Githooks - Fatal编程技术网

使用Git post update挂钩部署repo的/dist文件夹

使用Git post update挂钩部署repo的/dist文件夹,git,deployment,githooks,Git,Deployment,Githooks,这是一个更新后的钩子(取自),我在服务器上的裸存储库中设置了它。它将整个存储库部署到GIT_WORK_树的路径中: #!/bin/sh export GIT_WORK_TREE=/path/to/you/live/files git checkout -f 如何在Git中设置更新后挂钩,以便仅部署存储库的dist/文件夹?尝试此方法,基本方法如下: #/垃圾箱/垃圾箱 cd/path/to/you/live/files git存档--远程=dist | tar xvf- 谢谢!我有更多的信息。

这是一个更新后的钩子(取自),我在服务器上的裸存储库中设置了它。它将整个存储库部署到GIT_WORK_树的路径中:

#!/bin/sh
export GIT_WORK_TREE=/path/to/you/live/files
git checkout -f
如何在Git中设置更新后挂钩,以便仅部署存储库的dist/文件夹?

尝试此方法,基本方法如下:

#/垃圾箱/垃圾箱
cd/path/to/you/live/files
git存档--远程=dist | tar xvf-

谢谢!我有更多的信息。不过,我对Git语法有些头疼,然后我最终意识到我不需要在服务器上有一个空的存储库,我只是在dist/文件夹中执行了一个
rsync
,解决了我的问题。
#!/bin/sh
cd /path/to/you/live/files
git archive --remote=<repo_url> <branch> dist | tar xvf -