srcobranza srcobranza - 6 months ago 21
Linux Question

How to escape '@' (at) symbol when pulling git repository on Linux shell

I'm trying to pull a git repository from command line, specifying username and password inside the command, like this:

git pull https://username:password@myrepo.kilnhg.com/.../myRepo.git


The problem is that my username is an e-mail, so apparently the character '@' need to be escaped, if not, I receive the message:

fatal: repository 'https://username:password@myrepo.kilnhg.com/.../myRepo.git/' not found


Someone had the same problem and resolved it?

Answer

Usually, you can try and percent encode your password, replacing @ with %40

git pull https://username:<yourPasswordwith%40>@myrepo.kilnhg.com/.../myRepo.git
                                           ^^^