Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Help with .gitignore please

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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…

856 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