Flickr API Key and Version Control (Git)

I’m using git for version control; and I push my code to GitHub. Is there a way to keep the api key private apart from having a separate class where the api key is a constant and adding this class to .gitignore?
Any alternatives to the above mentioned workaround are welcomed.