2

I know the question may sounds weird but please hear me out, I am so confused. hope there are someone here can save me (I'm beginner to git..)

I am working on vs code, Win10, gitlab. I have 2 project-folders in the folder, both project cloned from gitlab:

C:\Users\Sam\Documents\gitlab\project_a and C:\Users\Sam\Documents\gitlab\project_b


when I open a particular project (project_a) on vs code, I can git pull/push with a box open-up for username & pw. [enter_username_pw]: https://i.stack.imgur.com/UKZOp.png


but when I open ANY OTHER projects directly, it said access denied. workflow as below:

  • open vs code
  • open folder project b
  • access denied as below --
PS C:\Users\Sam\Documents\gitlab\project_b> git pull
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitlab.com/project/project_b.git/'

What really confused me is when I open the particular project again on vs code (project a), then cd back to project b, I will be able to pull/push with the box pop-up for username and pw again. workflow as below:

  • open vs code of project b
  • git pull/push
  • access denied, without box for typing username / pw
  • closed vs code of project b
  • open vs code of project a
  • in the workspace of project a, open terminal
  • cd into project b
  • git pull/push
  • success with the box pop-up

feels like there is sth wrongly set with workspace and git credential but i dont have a clue... Could someone have any hint what's happening? Thank yo very much for any help...

Jakob Liskow
  • 1,323
  • 14
  • 22
  • Is `projectb` a subfolder in `projecta`? Is there any difference between `git config --local -l` when executed in the root folders of `projecta` and `projectb`? – VonC Nov 15 '21 at 08:22
  • Adding usernames in the urls (see https://stackoverflow.com/a/54835151/10710682) may fix it. – umitu Nov 16 '21 at 10:36

0 Answers0