Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
446 views
in Technique[技术] by (71.8m points)

git - How to keep different content of one file in my local and github repository?

I have a database.php. I want to keep it in my github repository without any sensitive information.

First I pushed to my repository without any sensitive info.

Now I added my database info so that I can use it locally.

I added to .gitignore. And I did rm --cached database.php. But it deleted the database.php from my github repository after a push.

How can I keep different content in my local and github repository?

Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You should make 2 different files one actual database.php and one database.php.example or something like that and then add database.php to .gitignore


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...