服务器中的存储库Git:Stg、Dev、Live
首先,我是Git的新手。事情是这样的:服务器中的存储库Git:Stg、Dev、Live,git,repository,Git,Repository,首先,我是Git的新手。事情是这样的: 我们最近迁移到一个新的服务器或活动站点,并且没有任何阶段实例。 因此,我希望有一个子域用于登台(或QA),另一个子域用于开发 我已经初始化了一个--bare存储库,我的问题是,“如何将位于同一服务器上的站点添加到此存储库?” 我不是从本地计算机添加,因为该站点的大小为15GB。所以,这会浪费很多时间 然后,我假设我需要将存储库克隆到每个子域中,并分别签出到stage和development阶段,不是吗 现在我有这个: /var/www/html/live/
我们最近迁移到一个新的服务器或活动站点,并且没有任何阶段实例。 因此,我希望有一个子域用于登台(或QA),另一个子域用于开发 我已经初始化了一个
--bare
存储库,我的问题是,“如何将位于同一服务器上的站点添加到此存储库?”
我不是从本地计算机添加,因为该站点的大小为15GB。所以,这会浪费很多时间
然后,我假设我需要将存储库克隆到每个子域中,并分别签出到stage和development阶段,不是吗
现在我有这个:
/var/www/html/live/ (All site files)
/var/www/html/repository.git/
/var/www/html/stging/ (empty)
/var/www/html/dev/ (empty)
这通常通过主裸repo
/var/www/html/repository.git/
中的3个分支完成
如果裸回购为空,则您希望对live文件夹的内容进行第一次提交:
export GIT_DIR=/var/www/html/repository.git
git config --bool core.bare false
git config user.name yourUserName
git config user.email yourEmail
cd /var/www/html/live
# edit a .gitignore file, listing big files and folders you should ignore
git add .
git commit -m "Live repo import"
# Make two other branches
git branch dev
git branch stg
# restore the bare repo nature
git config --bool core.bare true
unset GIT_DIR
然后,您可以在非裸实例中克隆您的回购:
cd /var/www/html/live
# no need to checkout HEAD: the files are already there
git clone --no-checkout /var/www/html/repository.git
cd /var/www/html/stging/
git clone --branch stg /var/www/html/repository.git
cd /var/www/html/dev/
git clone --branch dev /var/www/html/repository.git
这通常通过主裸repo
/var/www/html/repository.git/
中的3个分支完成
如果裸回购为空,则您希望对live文件夹的内容进行第一次提交:
export GIT_DIR=/var/www/html/repository.git
git config --bool core.bare false
git config user.name yourUserName
git config user.email yourEmail
cd /var/www/html/live
# edit a .gitignore file, listing big files and folders you should ignore
git add .
git commit -m "Live repo import"
# Make two other branches
git branch dev
git branch stg
# restore the bare repo nature
git config --bool core.bare true
unset GIT_DIR
然后,您可以在非裸实例中克隆您的回购:
cd /var/www/html/live
# no need to checkout HEAD: the files are already there
git clone --no-checkout /var/www/html/repository.git
cd /var/www/html/stging/
git clone --branch stg /var/www/html/repository.git
cd /var/www/html/dev/
git clone --branch dev /var/www/html/repository.git