V
V
vutmuk1232020-10-24 13:17:51
git
vutmuk123, 2020-10-24 13:17:51

How to make 2 files (local and heroku) with same name but different content via gitignore?

Hello. I apologize for the noob question, but it hasn't worked for 3 days already)
So, the project has a file with database access settings. for heroku and local development, they should naturally be different. I added the file to gitignor, but when I needed to edit and push it to heroku, git outputs something like "this file is in gitignor add the -f switch if you really want to push it" well, I add the key, after that the file seems to disappear from gitignor and when I change settings back to local after git add . (I sometimes want to push the entire project) everything crashes, because this file again contains local settings (on Heroku). did git rm --cached <filename>, didn't help..
I understand that I’m messing up something in the order of actions, but I don’t understand where ... Could someone explain step by step how to do it right?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MaxKozlov, 2020-10-24
@vutmuk123

you can use heroku's environment variables set through the settings, and locally .env
Just program so that the absence of a .env file does not interfere with the launch

A
Alexey Yarkov, 2020-10-24
@yarkov

Create a file with variables, I have this .env
Add it to gitignore
Push the repository to Heroku Via
ssh go to Heroku (Is it possible)
Create a file there with the same name
Everything is perfectly ignored and works

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question