请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

git 命令无法在shell中执行

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


正在回答

4回答

[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 回复 有任何疑惑可以回复我~
  • 提问者 qq_烈阳不骄_0 #1
    ,谢谢,重配了developer的权限,可以发不了,git命令前加sudu确实是会报command not found
    回复 有任何疑惑可以回复我~ 2018-04-22 09:01:05
  • Geely 回复 提问者 qq_烈阳不骄_0 #2
    嗯,ok
    回复 有任何疑惑可以回复我~ 2018-04-24 22:31:24
提问者 qq_烈阳不骄_0 2018-04-13 10:41:21

这是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 回复 有任何疑惑可以回复我~
提问者 qq_烈阳不骄_0 2018-04-13 10:40:56

直接执行是可以的,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 回复 有任何疑惑可以回复我~
提问者 qq_烈阳不骄_0 2018-04-13 10:40:18

[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 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信