打開倉庫設置中的辦理git鉤子,經由過程設置裝備擺設post-receive(提交后執行)來進行主動代碼更新,并主動clone項目
在鉤子文本中設置裝備擺設,之后每次push提交城市被觸發
#!/bin/bash
root_path='/www/xiaochengxu/project'
unset $(git rev-parse --local-env-vars);
mkdir -p $root_path
cd $root_path;
git clone git@ssh.gogs.com:xiaochengxu/project.git $root_path
if [ $? = 0 ]; then
chown -R 1000:100 $root_path && chmod -Rf g+s $root_path && chmod -R 775 $root_path
fi
git checkout .;
git pull origin master;
最終代碼主動生當作到指定的root_path目次
0 篇文章
如果覺得我的文章對您有用,請隨意打賞。你的支持將鼓勵我繼續創作!