apachecron备份到Github

apachecron备份到Github,apache,git,shell,github,Apache,Git,Shell,Github,我已经让ApacheCron为我的Codeigniter应用程序制作了一个备份tar文件,并将其放在服务器的/backup中。我想把这个发送到Github,但我对如何做有点困惑(我的shell脚本和Git体验有限) 非常感谢您的任何意见 谢谢 将tar发送回Git repo(GitHub与否)对我来说并不是一个长期的解决方案,因为Git无法区分该二进制文件(tar),而这将快速增加远程repo的大小 如果您仍然想这样做,那么简单的方法是: # declare a dedicated repo o

我已经让ApacheCron为我的Codeigniter应用程序制作了一个备份tar文件,并将其放在服务器的/backup中。我想把这个发送到Github,但我对如何做有点困惑(我的shell脚本和Git体验有限)

非常感谢您的任何意见


谢谢

将tar发送回Git repo(GitHub与否)对我来说并不是一个长期的解决方案,因为Git无法区分该二进制文件(tar),而这将快速增加远程repo的大小

如果您仍然想这样做,那么简单的方法是:

# declare a dedicated repo on your GitHub account
git clone git@github.com:user/repo.git/BackupRepo . # where the backup is
git checkout -b backup # make a special branch
git push origin backup # create that branch on the GitHub repo
然后,第一次:

# create your backup tar file
git add .
git commit -m "backup file"
git push
但是,对于希望再次推送更新的备份tar文件的其他实例,我建议:

# update your backup tar file
git add .
git commit --amend # modify the existing commit instead of creating a new one.
git push -f # force the push to replace the remote commit by this updated one.
换句话说,我们的想法是不记录该文件的历史记录,而是用一个新的系统地删除远程版本

最后,像(例如)这样的目录同步服务可能更易于使用;)