1

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!

  • 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 may help you https://stackoverflow.com/questions/6172719/escape-character-in-git-proxy-password – Popeye Feb 13 '19 at 12:11
  • @Popeye thanks a lot. It helps! – Bohdan Maliar Feb 13 '19 at 12:16
  • Possible duplicate of [Escape @ character in git proxy password](https://stackoverflow.com/questions/6172719/escape-character-in-git-proxy-password) – phd Feb 13 '19 at 13:31

1 Answers1

3

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.

Popeye
  • 11,839
  • 9
  • 58
  • 91