1.先找到服务器仓库的地址
新建post-receive文件
#!/usr/bin/env bash
"C:/python/gogs/gogs.exe" hook --config=‘C:/python/gogs/custom/conf/app.ini‘ post-receive
[python] view plain copy
#!/bin/sh ?
??
#author: embbnux ?
#Blog of Embbnux: http://www.embbnux.com ?
??
#判断是不是远端仓库 ?
IS_BARE=$(git rev-parse --is-bare-repository) ?
if [ -z "$IS_BARE" ]; then ?
echo >&2 "fatal: post-receive: IS_NOT_BARE" ?
exit 1 ?
fi ?
??
unset GIT_DIR ?
DeployPath="C:/python/platform_qa_test" //web端路劲
??
echo "===============================================" ?
cd $DeployPath ?
echo "deploying the test web" ?
??
#git stash ?
#git pull origin master ?
git fetch --all ?
git reset --hard origin/master ?
??
time=`date` ?
echo "web server pull at webserver at time: $time." ?
echo "================================================" ?
IDE push一次,就ok了
git--gogs自动部署到web
原文地址:https://www.cnblogs.com/hjm-hjm/p/9037612.html