markdown 创建一个知道子模块的非裸存储库。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 创建一个知道子模块的非裸存储库。相关的知识,希望对你有一定的参考价值。

# Remote GIT Repository with Submodules

## Post-receive Hooks template

Create a template of `post-receive` hooks to be populated in the `.git` folder everytine we initialize a repo.
The template directory should be registered in to the glogal git configuration. Create the hook subdirectory inside the folder.

``` bash
$ git config --global init.templatedir '~/.git-templates'
$ mkdir -p ~/.git-templates/hooks
```
Create the file `post-receive.sample` inside the hook directory, and set the file to be executable `chmod +x ~/.git-templates/hooks/post-receive.sample` below is the content of the file.

``` bash
#!/bin/sh
#
# An example hook script to update the working tree, including its
# submodules, after receiving a push.
#
# This hook requires core.worktree to be explicitly set, and
# receive.denyCurrentBranch to be set to false.
#
# To enable this hook, rename this file to "post-receive".

# Read standard input or hook will fail
while read oldrev newrev refname
do
:
done

# Unset GIT_DIR or the universe will implode
unset GIT_DIR

# Change directory to the working tree; exit on failure
cd `git config --get core.worktree` || exit

# Force checkout
git checkout --force

# Force update submodules
git submodule update --init --recursive --force
```

## Init the repo

``` bash
$ cd /path/to/your/working/folder
$ git init
$ git config --bool receive.denyCurrentBranch false
$ git config --path core.worktree ../
$ mv .git/hooks/post-receive.sample .git/hooks/post-receive
```

以上是关于markdown 创建一个知道子模块的非裸存储库。的主要内容,如果未能解决你的问题,请参考以下文章

节点或shell脚本中有没有办法知道子进程是不是启动了自己的子进程?

管道子流程标准输出到变量[重复]

markdown git创建一个新的存储库

markdown 使用git push为项目部署创建一个裸的远程git存储库

如何在为知笔记中用Markdown创建目录大纲

如何在为知笔记中用Markdown创建目录大纲