Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git asking for user credentials (Gitlab)

Tags:

git

gitlab

I want to do my inital commit on a project. Git online and local repos are already set up and the ssh key should also work properly. I'll use example.com as reference for my git server.

When I type ssh [email protected] I get Welcome to GitLab, Name Surname!

When I try to push my first commit git push --set-upstream origin master it is asking for user credentials, but I'm not sure where to find those. I got a loginname and password from my company and on GitLab my username is name.surname. I tried both combinations loginname/password and username/password but both say

remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitlab.example.com/name.surname/project.git/

Later on I want to achieve the connection directly in Visual Studio, but there happens the same, when I want to push something, it's asking for user credentials.

like image 497
Ian Fako Avatar asked Jun 18 '26 21:06

Ian Fako


1 Answers

Your remote (origin) is set to the https URL instead of the ssh URL.

See the output of git remote show origin.

You can change the URL using:

git remote set-url origin [email protected]:name.surname/project.git
like image 100
marcolz Avatar answered Jun 21 '26 21:06

marcolz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!