I had the following problem when trying to execute some git commands from the rake rake task (I tried without bash --login -c and get the same result).
tmpid='TueJan26014125UTC2010' cmd=["git add .", "git commit -a -m \'Migrate nanoc3 co output to gh-pages #{tmpid}\'", "git push --force origin gh-pages:gh-pages" ] FileUtils.chdir @gh_pages_repo_path.to_s do puts `pwd` cmd.each do |cmdi| puts "bash --login -c '#{cmdi}'" res=Kernel.send(:`, "bash --login -c '#{cmdi}'") puts res end end
I this conclusion indicates that the working directory and git push are not working
/home/mv/Documents/Workspaces/scar/ruby/scar/gh-pages bash --login -c 'git add .' bash --login -c 'git commit -a -m 'Migrate nanoc3 co output to gh-pages TueJan26014125UTC2010''
If I run the same commands, right after that from the bash shell (console) everything happens fine:
$ pushd /home/mv/Documents/Workspaces/scar/ruby/scar/gh-pages /usr/src ~ $ git add . $ git commit -a -m 'Migrate nanoc3 co output to gh-pages TueJan26014125UTC2010' [gh-pages 14cbe34] Migrate nanoc3 co output to gh-pages TueJan26014125UTC2010 20 files changed, 100 insertions(+), 0 deletions(-) $ git push --force origin gh-pages:gh-pages Counting objects: 73, done. Compressing objects: 100% (19/19), done. Writing objects: 100% (38/38), 11.32 KiB, done. Total 38 (delta 16), reused 0 (delta 0) To git@github.com :hedgehog/scar.git e0f0370..14cbe34 gh-pages -> gh-pages
Appreciate any ideas.
source share