I have cloned a repo via the git CLI like this
git clone https://gitlab.myserver.com/myroot/myrepo.git/
Then in VS Code I develop on this repo and I can commit my changes in VS Code.
When I now try to push the changes in VS Code I get the following git-error output:
> git push origin main:main
fatal: unable to access 'https://gitlab.myserver.com/myroot/myrepo.git/': Couldn't connect to server
However when I push on the command line (via git push) I can push.
How can I fix this in VS Code? Is the problem that I used HTTP(S) for cloning? If so how do I tell VS Code about it?
Note: I have installed an ssh key. It is in the normal ~/.ssh/ location (macOS). No sure whether the CLI uses them with the HTTPS remote, but the CLI access via HTTPS works. So how can I tell VS Code to use the HTTPS remote as well?
You're using
httpsbecause that is what you cloned with, so its not going to use yoursshkey at all. If you prefer to use ssh, just switch your remote with the following command: