git 命令无法在shell中执行

来源:13-7 线上环境安装配置实操(git)

qq_烈阳不骄_0

2018-04-13

git命令在服务器上能运行,但编程shell脚本就不认识了,,怎么解


写回答

4回答

Geely

2018-04-21

[shaoyang@iZ2zeiz2rcx33nwq8ubi70Z developer]$ sudo ./deploy.sh

===========进入git项目happymmall目录=============

==========git切换分之到mmall-v1.0===============

./deploy.sh: line 6: git: command not found


检查一下环境变量,还有你执行这个命令的用户,你用的shaoyang,看看这个sh的权限是什么样的,发一下,用chmod chgrp chown来修改对应用户及用户组和权限。

0
2
Geely
回复
qq_烈阳不骄_0
嗯,ok
2018-04-24
共2条回复

qq_烈阳不骄_0

提问者

2018-04-13

这是shell脚本

echo "===========进入git项目happymmall目录============="

cd /developer/git-repository/mmall_learning



echo "==========git切换分之到mmall-v1.0==============="

git checkout v1.0


echo "==================git fetch======================"

git fetch


echo "==================git pull======================"

git pull



echo "===========编译并跳过单元测试===================="

mvn clean package -Dmaven.test.skip=true


0
0

qq_烈阳不骄_0

提问者

2018-04-13

直接执行是可以的,shell里面就不识别了

[shaoyang@iZ2zeiz2rcx33nwq8ubi70Z developer]$ cd /developer/git-repository/mmall_learning

[shaoyang@iZ2zeiz2rcx33nwq8ubi70Z mmall_learning]$ git checkout v1.0

Already on 'v1.0'

Your branch is up-to-date with 'origin/v1.0'.

[shaoyang@iZ2zeiz2rcx33nwq8ubi70Z mmall_learning]$ git fetch

remote: Counting objects: 6, done.

remote: Compressing objects: 100% (6/6), done.

remote: Total 6 (delta 3), reused 0 (delta 0)

Unpacking objects: 100% (6/6), done.

From gitee.com:linkenfaqiu/mmall_learning

   b85829e..a78d713  v1.0       -> origin/v1.0

[shaoyang@iZ2zeiz2rcx33nwq8ubi70Z mmall_learning]$ git pull

Updating b85829e..a78d713

Fast-forward

 src/main/resources/mmall.properties | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)


0
0

qq_烈阳不骄_0

提问者

2018-04-13

[shaoyang@iZ2zeiz2rcx33nwq8ubi70Z developer]$ sudo ./deploy.sh

===========进入git项目happymmall目录=============

==========git切换分之到mmall-v1.0===============

./deploy.sh: line 6: git: command not found

==================git fetch======================

./deploy.sh: line 9: git: command not found

==================git pull======================

./deploy.sh: line 12: git: command not found

===========编译并跳过单元测试====================

./deploy.sh: line 16: mvn: command not found

============删除旧的ROOT.war===================

======拷贝编译出来的war包到tomcat下-ROOT.war=======

============删除tomcat下旧的ROOT文件夹=============

====================关闭tomcat=====================


0
0

从0开始 独立完成企业级Java电商网站服务端开发

前后端分离,数据库接口设计,架构设计,功能开发,上线运维

9476 学习 · 8804 问题

查看课程