I’m writing a bash script to add, commit, push all files in a directory.
#!/bin/bash
git add .
read -p "Commit description: " desc
git commit -m $desc
git 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
I’m not sure if this is a problem with reading in the text (it echos fine) or passing it to git commit -m.
You have to do:
In the current script,
testis going as commit message andcommitandscriptare being treated as next arguments.