Solved

Help with .gitignore please

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tortoise svn - modified date 1 411
Best process for "back-porting" changes to prior release 4 222
version control for SSRS report files 7 122
team foundation server 3 75
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…
Article by: gr8gonzo
Git can be a complicated version control system for beginners, but it definitely is one of the best ones out there. Since this article assumes that you're starting at square one, it will skip over things that Git -can- do and will focus on the typic…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

26 Experts available now in Live!

Get 1:1 Help Now