Solved

Help with .gitignore please

Posted on 2011-02-22
3
1,075 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

776 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