gpt4 book ai didi

Git 提交 bash 脚本

转载 作者:IT王子 更新时间:2023-10-29 00:59:15 36 4
gpt4 key购买 nike

我正在编写一个 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 的问题。

最佳答案

你必须做的:

git commit -m "$desc"

在当前脚本中,test 将作为提交消息,而 commitscript 将被视为下一个参数。

关于Git 提交 bash 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8482843/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com