Aurora使用git部署

1. git部署设置

—1、进入目录
cd /data/webapp
—2、执行
echo “HEC/“>.git/info/sparse-checkout
—3、验证
cat .git/info/sparse-checkout

说明:webapp已存在 HEC文件夹,需要从远程拉取与HEC文件夹合并

=========================================================================
0、备份webapp目录
进入/data目录:cd /data
执行备份操作 :cp -r webapp webapp.bak01
1、进入 /data/webapp 目录 : cd /data/webapp
2、初始化目录,执行:git init
3、添加远程仓库地址:git remote add -f origin http://git.test.com/myProject/HEC/Src.git
4、开启sparse checkout功能:git config core.sparsecheckout true
5、将需要获取的目录写入到该文件中:
echo “HEC/webRoot/modules/“>>.git/info/sparse-checkout
echo “HEC/webRoot/WEB-INF/classes/“>>.git/info/sparse-checkout
6、验证:cat .git/info/sparse-checkout
7、拉取远程分支:git pull origin master
第7步异常,出现错误,可以参照错误处理中2来处理

8、检查确认以下配置文件:
/data/webapp/HEC/webRoot/WEB-INF/uncertain.local.xml
/data/webapp/HEC/webRoot/WEB-INF/aurora.database/datasource.config

=====================================================================================================
错误处理:
1、拉取文件和本地文件冲突:
(1)报错信息:
error: Your local changes to the following files would be overwritten by merge:
XXXXX
……
Please, commit your changes or stash them before you can merge.

(2)处理方式:
执行:git stash
再拉取:git pull origin master

2、首次拉取,执行到第7步报错
(1)错误消息:
error: The following untracked working tree files would be overwritten by merge:
HEC/webRoot/WEB-INF/classes/acp/XXX
……

(2)处理方式,直接拉取覆盖本地代码:
git fetch origin master
git reset —hard origin/master
git pull origin master

2.git范围修改

—1、备份
cp -r ./HEC HEC.bk1

—2、进入目录
cd /data/webapp

—3、确定在git范围[HEC/] 如果不是则执行 3.1和3.2
cat .git/info/sparse-checkout
—3.1、执行
echo “HEC/“>.git/info/sparse-checkout
—3.2、再次验证
cat .git/info/sparse-checkout

—4确定是否在master分支,不在则切换
git branch
git checkout master

—5、在/data/webapp/HEC 下执行删除命令
cd /data/webapp/HEC
rm -rf *

—6、在/data/webapp/HEC 下执行
git stash

—7、在/data/webapp/HEC 下执行
git pull origin master

—8、重启tomcat
cd /data/webapp/tomcat_1/bin
./shutdown.sh
./startup.sh

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值