Re: [msysGit] Automate git-pull as windows scheduled task

2,885 views
Skip to first unread message

Pat Thoyts

unread,
Dec 7, 2012, 12:49:20 PM12/7/12
to lance....@gmail.com, msy...@googlegroups.com
On 7 December 2012 17:42, <lance....@gmail.com> wrote:
> Hey all, have our repo at github and have things running under a windows
> test webserver. Things work as expected, but I need to automate better (will
> do this in 2 phases but I need phase 1 to just work right now.).
>
> Phase1 is to simply do a git-pull every x minutes. If I click the git
> shell, then type git pull, things work, so is there a way to append the
> shortcut to include that git-pull?
>
> I tried using the windows command line git pull in that folder and I am
> prompted for a user/pass and didn't see an option to pass those.
>
> I know it's not the ideal situation, but it will enable me to start moving
> forward and working on phase2.
>
> Thanks.
Create a batch script to perform your task and enable the wincred
credential helper so your session can record your github credentials.
git config --global credential.helper wincred
git remote set-url --push origin https://YOUR...@github.com/.....

Try it out (you can use git push --dry-run origin master) to get the
credentials logged.
With that batch script ready you can create a scheduled task that runs
your batch script at regular intervals.
You may need to fetch the git-credential-wincred file from
https://github.com/msysgit/git/downloads as I don't think its in the
1.8.0 release.

Konstantin Khomoutov

unread,
Dec 7, 2012, 5:30:06 PM12/7/12
to lance....@gmail.com, msy...@googlegroups.com
On Fri, Dec 07, 2012 at 10:49:23AM -0800, lance....@gmail.com wrote:

[...]
> > > Phase1 is to simply do a git-pull every x minutes. If I click the git
> > > shell, then type git pull, things work, so is there a way to append the
> > > shortcut to include that git-pull?
[...]
> > Create a batch script to perform your task and enable the wincred
> > credential helper so your session can record your github credentials.
> > git config --global credential.helper wincred
> > git remote set-url --push origin https://YOUR...@github.com/.....
> >
> > Try it out (you can use git push --dry-run origin master) to get the
> > credentials logged.
> > With that batch script ready you can create a scheduled task that runs
> > your batch script at regular intervals.
> > You may need to fetch the git-credential-wincred file from
> > https://github.com/msysgit/git/downloads as I don't think its in the
> > 1.8.0 release.
> >
> Thanks, I will create the batch script once I see it working (I think that
> is the easiest part). So I downloaded the cred-helper, I extracted it to
> the git\libexec\git-core folder as it looks like that is where it belongs.
>
> I ran;
> git config --global credential.helper wincred
> git remote set-url --push origin https://github.com/user/repo.git (I got
> this URL from the github site, under HTTP which I think is correct)
>
> Both of the above gave no output, errors, etc. so I guess that's good. I
> then ran the dry run test;
>
> C:\inetpub\wwwother\domain1.com>git push --dry-run origin master
> Username for 'https://github.com': user
> Password for 'https://us...@github.com':
> fatal:
> https://github.com/myrepo/reponame.git/info/refs?service=git-receive-pack
> not found: did you run git update-server-info on the server?
>
> I did try the update-server-info but got the same result. (Note for this
> user, the branch is pull only, not sure if that matters or not).

git-receive-pack is stated to receive objects (that is, on the server
side it's started to serve a push), and in your original mail you say
you want to pull, and now you also state that branch is for pulling
only. So I think the error you're seeing is exactly about this: you
cannot push to that branch.
Hence it looks you took the Pat's suggestion too literally, and should
have tried to pull to get the credentials logged, not push.

Reply all
Reply to author
Forward
0 new messages