1

我正在从 Github 拉到我们网站的网络服务器。所有操作都是通过 bash 脚本和 scalr 完成的。在我们的网站中,其中一个文件夹是 NFS 挂载到 S3 文件夹。有没有一种方法可以在不杀死该文件夹并且不必重新安装它的情况下进行拉动?这是我当前的脚本:

## Git Clone -------------------------------------------------------------------

if [ -d "$DEPLOY_PATH"/.git ]; then
    cd "$DEPLOY_PATH"
    if $GIT_PATH status >/dev/null 2>&1; then
       $GIT_PATH pull
       exit 0
    fi
fi

$GIT_PATH clone $GIT_REPO_URL $GIT_CL_DIR  .

## Git Checkout ----------------------------------------------------------------
# There should be *no* changes to the pristine repo.
echo "Ensure pristine copy. Executing 'git reset --hard'."
$GIT_PATH reset --hard HEAD 2>/dev/null

echo "Pulling updates from $GIT_REMOTE"
$GIT_PATH fetch $GIT_REMOTE

current_branch=$($GIT_PATH branch | awk '/\* /{print $2}')

if [[ "$current_branch" = "$GIT_BRANCH" ]] then
    echo "Already on branch '$GIT_BRANCH'."
elif ! $GIT_PATH branch | awk "/$GIT_BRANCH$/" >/dev/null 2>&1 then
    echo "Checkout of branch '$GIT_BRANCH'"
    $GIT_PATH checkout -b $GIT_BRANCH --track $GIT_REMOTE/$GIT_BRANCH 2>/dev/null

elif ! $GIT_PATH checkout $GIT_BRANCH 2>/dev/null then
    echo "Branch '$GIT_REMOTE/$GIT_BRANCH' not found. Skipping remainder of update." 1>&2
    exit 1
fi

# Run our git commands
$GIT_PATH pull

## Get submodules, if exist.
if [ -e ".gitmodules" ]
then
    echo "Updating submodules."
    $GIT_PATH submodule init 2>/dev/null
    $GIT_PATH submodule update
fi

然后我安装文件夹等....

4

1 回答 1

1

一种方法是符号链接到挂载的目录。
即使该符号链接驻留在 git 工作树中,它也不会受到 Git 的影响,因为它不遵循符号链接(详见“让 git 遵循符号链接(再次) ”)

于 2012-10-26T08:39:20.520 回答