Cloned my project from Git and now have an Error accessing credentials.yml.enc
Hi all,
I cloned my project to my laptop but when I try to access credentials.yml.enc with rails credentials:edit, I get this error:
Couldn't decrypt config/credentials.yml.enc. Perhaps you passed the wrong key?
Can anyone give me the steps to properly reset my credentials.yml in a cloned repo?
Thanks,
Jim
Hey Jim!
Since the credentials file contains API keys and other secrets, only the encrypted file gets stored in git. The matching config/credentials.key
contains the key to decrypt that file. The key should not be stored in the repo, otherwise it wouldn't be secure and you might as well store the keys in plain text.
So you'll have to grab the config/credentials.key
file from your other computer and add it to your laptop.
Keep that key safe like a password. It's the only way to decrypt the credentials.
lol. that sucks. I'm in Fla and my computer is in PA. I guess it defeats the purpose, but can it be reset locally so I can finish my tutorial? ":)
Doh! You can delete the file and generate new credentials. That's probably the easiest option and then you can save the .key file somewhere safe this time. 😅