Auto-backup shell github -


i wrote script auto-backup website , script push resources github. wrote code in crontab let auto-execution. however, don't know why resources can't pushed.

i can see heads .git has been modified (which means commit successfully). guess problem incorrect use of username.

the information below output of auto-backup script.

committer: root <root@xxxx.(none)> name , email address configured automatically based on username , hostname. please check accurate. can suppress message setting them explicitly:         git config --global user.name "your name"     git config --global user.email you@example.com     after doing this, may fix identity used commit with:         git commit --amend --reset-author      1 file changed, 14 insertions(+), 14 deletions(-) 

how can deal it?

the command in crontab:

*/2 * * * * root /var/backwiki.sh >/home/xxx/tmp/4.txt 

here main part of shell script:

 git pull origintyl master git add -a echo '2' git commit -a -m $nowtime echo '1' git push origintyl master echo '3' 

orignintyl means:

 `[remote "origintyl"]` `url = https://accoutname:password@github.com/xxxx/xxxx.git` `fetch = +refs/heads/*:refs/remotes/origintyl/*` 

you should first test script under own account, git config user.name , user.email must set properly.

then should register script top cron, making sure executed you, not root, each user having his/her own crontab.

run cron jobs different user:

su - <user> -c <command or script> 

the op yulong tian confirms in comments:

i have solved problem changing user (not root before) in crontab.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -