Ask A Question


You’re not receiving notifications from this thread.

Cloned my project from Git and now have an Error accessing credentials.yml.enc

Jim Miller asked in Rails

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?




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. 😅


that sounds good! live and learn. luckily this is only a tutorial.

thanks Chris

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,038+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.