1

私はGithubから私たちのサイトのウェブサーバーに引っ張っています。すべてのアクションは、bashスクリプトとscalrを介して実行されます。私たちのウェブサイトでは、フォルダーの1つはS3フォルダーへのNFSマウントです。そのフォルダを強制終了して再マウントせずにプルを実行できる方法はありますか?これは私の現在のスクリプトです:

## 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

1つの方法は、マウントされているディレクトリにシンボリックリンクすることです。
そのシンボリックリンクがgit作業ツリーに存在する場合でも、シンボリックリンクをたどらないため、Gitの影響を受けません(「gitがシンボリックリンクをたどる(再び)」で詳しく説明されています)。

于 2012-10-26T08:39:20.520 に答える