Solved

Help with .gitignore please

Posted on 2011-02-22
3
1,062 Views
Last Modified: 2012-05-11
Git noob looking for clarification of how .gitignore works please.

For instance, I have a CodeIgniter app repo set up on github.com, but I am trying to keep the my account details out of config.php and database.php.

I've been able to get exactly two different scenarios to work:

1. Missing Files

,gitignore working as expected, but the repo does not conatin any config.php or database.php file.

2. Files exist

.gitignore is in place. The config.php and database.php files exist as well and their changes are tracked so sensitive stuff ends up in public.
Is there not a way to upload the original file, push it to the repo, and then add the files to .gitignore so that any further changes are not tracked?
0
Comment
Question by:TunaMaxx
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
syahmixp earned 500 total points
ID: 34960648
You might want to make config.php and database.php without any sensitive information, commit it and push it into server. Then, you can add sensitive information into this file, next commit, you can simply skip committing this two file by untracking it.

See this how to untrack file while keep the file intact: http://source.kohlerville.com/2009/02/untrack-files-in-git/
0
 

Assisted Solution

by:TunaMaxx
TunaMaxx earned 0 total points
ID: 34964448
Thanks for the info and the link. There is great info there.

I have since been offered another piece of advice as well. The suggestion was to have:

config.php - with sensitive info in the file
config.example.php - without sensitive info in the file
database.php - with sensitive info in the file
database.example.php - without sensitive info in the file

Then add config.php and database.php to the .gitignore file. The 'example' files will be uploaded, but the other will not. Win win!
0
 

Author Closing Comment

by:TunaMaxx
ID: 34995491
My solution was accepted in addition to the one by syahmixp as an alternate viable answer.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

INTRODUCTION Subversion is a fantastic version management and software configuration management tool for teams and individuals to manage software applications. It offers many advantages over it's CVS ancestor such as it's built-in compatibility w…
When working in a large software development team, whether you have many developers working on the same projects, or your project is linked to other projects; it is very important that developers regularly perform "get latest" to ensure that the cha…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now