2

I'm using git to deploy my site, however, I'm trying to figure out why using the following script, files keep accumulating in my list of working copy. Meaning that, every different file that I commit and push to my bare repository gets listed as: M filename.php

Also, I'm wondering what does the following warnings mean? and how can I avoid them?

To mike@server10:/home/www/site1/.git
   07155f1..e80c2db  master -> master
Push to checked out branch refs/heads/master

W:unstaged changes found in working copy
W:stashing dirty working copy - see git-stash(1)

Saved working directory and index state "On (no branch): dirty working copy before update to e80c2db3212a7eb33da2e218001122e0decae640"

Checking out files: 100% (6362/6362), done.
HEAD is now at 07155f1 updated file path
trapped 22921
Updating working copy
M       image.php
M       ask.php
M       basic.php
HEAD is now at e80c2db updated text style

Thanks

Community
  • 1
  • 1
Mike Sullivan
  • 85
  • 1
  • 3

2 Answers2

2

This means your destination repo, which isn't bare (i.e. there is a .git plus a working copy checked out), isn't "clean": the "git status" would not return on that remote repo a clean status, like "nothing to commit (working directory clean)".

That is why you see stashing warning (Git tries to save the files "being modified").

You need first to make sure the remote repo has a clean status (by resetting its working tree to the latest commit on the deployment branch, making sure a git branch indicates that your are on that branch) before running this script.

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • Following from VonC's comment - perhaps you need to make the repo bare so that it stays clean, rather than having working stuff on that repo - do you/others actually do work on the repo.... – Philip Oakley Jun 04 '11 at 18:28
  • @Philip Oakley: Yeah, actually that's what I was thinking. I've seen several ways that a deployment can be done using git, however, I'm still trying to find out perhaps an optimal way. Any ideas? – Mike Sullivan Jun 04 '11 at 21:36
  • @Philip Oakley: No, I'm the only one working on that repository. – Mike Sullivan Jun 04 '11 at 21:43
  • @Mike: alternatives are based on a bare repo and a post-update hook: http://stackoverflow.com/questions/3753520/git-push-to-refs-remotes-mine-master/3753712#3753712 and http://stackoverflow.com/questions/2062657/can-i-use-git-to-keep-a-remote-server-up-to-date/2062719#2062719 – VonC Jun 04 '11 at 23:06
0

Why not you just make the hooks/post-receive script do a git checkout -f to have it do a checkout from a bare repository into the deployment path?

Take a look on how I did it.

Community
  • 1
  • 1
Alexandre Marcondes
  • 5,428
  • 2
  • 22
  • 31