Wednesday, December 30, 2009

Git and Unfuddle for python project - using .ignore

This is a reminder to me in case I forget how I got this working.

Main development environment is local laptop
Master reponsitory on Unfuddle.com
Live environment on remote server

There are a few files, like settings.py, that I don't want to be synced and as these files were already in the repository I'd created, git kept trying to sync them.

To resolve:
Assuming already have everything setup - remote server setup with clone from unfuddle.

Create .gitignore file as part of repository:

settings.py
*.pyc
*~
site_media/avatars/*

Remove settings.py from git without deleting on both local and remote environments.

In Local environment:
git rm --cached settings.py
git commit -a -m "remove settings.py"
git push unfuddle master
In remote live environment
git rm --cached settings.py
git commit -a -m "remove settings.py"
git push

That should do it. Now commits can be exchanged without settings.py being updated.

No comments: