卸载重装git
git --version
yum remove git
yum -y install git
配置git
git config --global user.name "******"
git config --global user.email "******@126.com"
生成秘钥
ssh-keygen
将公钥文件内容填入码云(头像=》设置=》安全设置=》SSH公钥=》添加)
/root/.ssh/id_rsa.pub
下载maven
https://dlcdn.apache.org/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.zip
unzip apache-maven-3.8.3-bin.zip
安装maven
vi /etc/profile
export MAVEN_HOME=/usrapache-maven-3.8.3
export PATH=$PATH:$MAVEN_HOME/bin
:wq!
source /etc/profile
mvn -v
下载git代码
mkdir git
cd git
git clone git@gitee.com:*******.git
ll -al
git pull origin master
创建脚本
vi deploy.sh
#!/bin/bash
echo 进入项目目录
cd /usrgit/me-server/w4me
echo 拉取最新代码
git pull origin master
echo 关闭老线程
echo $(ps -ef | grep w4me | grep -v grep)
echo $(ps -ef | grep w4me | grep -v grep | awk '{print $2}')
pid=$(ps -ef | grep w4me | grep -v grep | awk '{print $2}')
if [ -n "$pid" ]
then
echo kill -9 $pid
kill -9 $pid
fi
echo 打包启动新线程
mvn clean package -Dmaven.test.skip=true
cp -R /usrgit/me-server/w4me/target/w4me.jar /usrspringboot
nohup java -jar /usrspringboot/w4me.jar --spring.profiles.active=preview &
:wq!
chmod -R 777 ./deploy.sh
部署
./deploy.sh
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)