How to encrypt environment variables correctly?

I’m trying to encrypt sensitive environment variables with “travis encrypt SOMEVAR=“value” --add”

What I want to encrypt is Team A?B! that includes space.
I did it with quoting because there is space!!
Like this.

travis encrypt SOMEVAR="Team A?B!" --add 

But it doesn’t work. when I tried to encrypt just Team, I works very well…
Anybody can help me?

? and ! are special characters, so they need to be escaped if you are handing them directly to travis encrypt. You can try escaping them, or supplying this string through STDIN.

Also, I strongly advise you against using a space in an environment variable in bash. When interpolated it can break commands in unexpected ways and it’ll be hard to troubleshoot it.