Search code examples
gitcredentialsgit-push

Git push using credentials with login as email


Recently I have the following command to push to my git repository

git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/my-org/my-repo.git

But, now I should push when my GIT_USERNAME in the format of email like a: test@test.com and after that I have the following problem:

Could not resolve host: test.com

How can I push to git using the username as email and password?

P.S. I cannot get any SSH keys. I have only username and password.

Thanks in advance!


Solution

  • You'll need to encode the username before you push to ensure that the @ is actually %40 instead so it would actually look like git push https://user%40test.com:password@github.com/my-org/my-repo.git.

    This link will explain more about URL Encoding if you want to read about it.