git push force, phpFog, and random file not in my repo showing up
Asked Answered
L

1

8

I'm using phpFog and have been deploying via git push -f <repo> to overwrite existing contents on the server. Some of my deployments were from totally different repos, as I was experimenting with some things.

I've found a file from a previous push, which no longer exists in the currently pushed repo, is lingering on the server. I can delete that file (via a php script), but each new push to the server will re-create that file -- even when the newly pushed repo doesn't contain it.

Lesson learned is to not push w/ force, I supposed -- but why is that random file being recreated when pushing repos that don't contain it?!

Again here is what I'm seeing:

  • git push -f repo_1 (contains random.txt)
  • random.txt exists
  • I delete all files, random.txt is now gone
  • git push -f repo_2 (does not contain random.txt)
  • random.txt exists again (why?!)

EDIT: I'm assuming that forcing changes to the repo leaves older files still being tracked, even if the new repo never tracked them. I've modified my deploy method to now clone what is on phpFog, git remove everything, and add in my new files before pushing. https://github.com/swt83/phpfog-deploy

Lordly answered 5/2, 2012 at 20:17 Comment(2)
+1 for using phpFog... even if to me it seems a bit too expsensiveKonya
Are you just deleting the file without committing it or letting git know that it has been deleted? You may need to remove it from the index (git rm --cached random.txt) and commit that.Kiesha
T
0

Some of my deployments were from totally different repos

If you have a working copy (one that isn't borked), could you simply remove the git source directory and CLONE/PULL your working copy?

When committing, git commit -am "Message here" has always found deleted files and such. Is this the command you use to commit?

You may also succeed by trying to remove the text file from git's list:

git rm --cached random.txt

Github shows you how to keep that file from being tracked.

Tinkling answered 10/2, 2012 at 3:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.