Not able to push and pull code to gitlab using vscode terminal

hey,
So our developers who are using ubuntu 20.04lts are not able to push or pull code to gitlab from thier vs code terminal.
It was working fine all these days but then suddenly they are facing the issue lately.

remote: HTTP Basic: Access denied
fatal: Authentication failed for xxx

the vs code is the latest version and also gitlab extensions were installed as well.

so, what might be the problem?

Can you browse gitlab.com website, or do you see a looping screen about checking your browser? If so, probably there is an issue with your IP addresses. Try a VPN or from a different location so different IP and see if you can access.

This problem is quite common, there are a number of posts on this forum about it.

yeah we are using self hosting gitlab and we can use it. there is no problem with respect to access because we are able to clone it too.

But then the problem arises when we push the code though.
Also, when they try to push the code from the ubuntu terminal it was working fine.

so, there is no problem while cloning/pulling/pushing using git bash or ubuntu terminal.

Problem arises only while using the vs code terminal.

Like i said before it was working fine before but lately it behaves like this.

OK, just wondered if using gitlab.com as sometimes the Cloudflare stuff can intervene.

I have self-hosted also, I’ll check with my VS Code to see if I can push/pull etc. Are you running the latest version of VS Code?

I originally cloned my repos from the console in bash (Linux Mint for me), and later started to use VS Code. I’ve never attempted to clone a repo directly from VS Code though, so not sure if this would make a difference in terms of those issues or not.

EDIT:

I was able to push OK. Generally VS Code has worked fine for me, although I haven’t used it much as tended to use Atom. I’ll try and use it more now instead of Atom to see if I can replicate the issue on my self-hosted Gitlab.

yeah, we are using the latest version of vs code.
we have also tried updating the git password too.
i am not sure what the problem is
will looking into logs in the git production machine help?
cuz the error means it is mostly an authentication issue.

I use personal access tokens for authentication in the .git/config file, so my remote origin looks like this:

[remote "origin"]
	url = https://iwalker:my-access-token@gitlab.example.com/mygroup/myproject
	fetch = +refs/heads/*:refs/remotes/origin/*

and I use https instead of ssh.

we are not using personal access token till now, maybe we shall try and see.
Also, in the git config file i gave the username before the gitlab repository like how you did there.

thank you

1 Like

It might be helpful to use Git embedded traces to identify where the problem is occuring: Useful Git commands | GitLab

GIT_TRACE_PACKET=1 GIT_TRACE=2 GIT_TRACE_SETUP=1 GIT_CURL_VERBOSE=1 git [command]