我正在编写一个Bash脚本,用于将目录中的所有文件添加、提交、推送到远程仓库。
#!/bin/bash
git add .
read -p "Commit description: " desc
git commit -m $desc
git push origin master
我遇到了以下错误:
$ ./togithub
Commit description:
test commit script
error: pathspec 'commit' did not match any file(s) known to git.
error: pathspec 'script"' did not match any file(s) known to git.
Everything up-to-date
我不确定这是否是读入文本的问题(它可以正常地echo
),或者将其传递给git commit -m
的问题。
./myscript.sh git commit -m \"my commit message\"
。 - chuckwired