I want to commit some file from a script to a git server I own, and this needs to be done automatically.
My script (that resides in ~/bin) does something like this
rsync -arE --delete --files-from=~/files.list / ~/repo
git --git-dir ~/repo/.git add ~/repo/*
git --git-dir ~/repo/.git commit -m "automatic commit #123"
git --git-dir ~/repo/.git push
I want it to copy the files that are listed in the file ~/files.list to ~/repo (rsync handles this) and then add this files to the repository, commit and push.
However, it is unable to correctly add files to the git commit, particularly it always grabs the files that are in the working directory (in this case ~/bin), so I would need a way to either:
- change the running directory for the
gitcommands OR - tell git to add files from a directory other than the working one
git add -Ato add everything. Use in conjunction with a .gitignore.