本文介绍了Git提交bash脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I'm writing a bash script to add, commit, push all files in a directory.
我正在编写一个bash脚本来添加,提交和推送目录中的所有文件。 / bash
git add。
read -p提交描述:desc
git commit -m $ desc
git push origin master
#!/bin/bashgit add .read -p "Commit description: " descgit commit -m $descgit push origin master
我收到以下错误:
I'm getting the following error:
$ ./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 。
I'm not sure if this is a problem with reading in the text (it echos fine) or passing it to git commit -m.
推荐答案
您必须这样做: p>
You have to do:
git commit -m "$desc"
在当前脚本中, test 会作为提交消息, commit 和 script 被视为下一个参数。
In the current script, test is going as commit message and commit and script are being treated as next arguments.
这篇关于Git提交bash脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!