'fatal: unable to access cannot resolve host gitlab error when using HTTPS git repository

This is in WSL2 running ubuntu 20.04.

I am trying to use an existing set of code that is on my computer and put it into an empty repository I have on gitlab that is set to HTTPS. It is not set up for SSH and cannot be switched to SSH. All the answer I've seen have been for SSH and have not worked.

This is what I did:

git init
git remote add origin https://username@url/repository.git
git config http.sslVerify "false"
git commit -m "message"
git push -u origin master

Which gave the error fatal: unable to access [url] could not resolve host [host]

This is what I've tried since:

git set-origin https://username@url/repository.git
git set-url origin https://username@url/repository.git

All have given the same error after when trying to push again. It hasn't given me prompts to login like it does when doing git -c http.sslVerify=false clone https://username@url/repository.git

Is there anyway to get it to verify this way or do I have to just clone the repository elsewhere and copy everything over?

Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source