Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab git user password

Tags:

git

gitlab

People also ask

How do I find my GitLab credentials?

To assist, GitLab provides a Credentials inventory to keep track of all the credentials that can be used to access their self-managed instance. Use Credentials inventory to see for your GitLab instance all: Personal access tokens (PAT). Project access tokens (GitLab 14.8 and later).

What is the default username and password for GitLab?

GitLab's administration interface is accessed over the web. Simply point your browser to the hostname or IP address where GitLab is installed, and log in as an admin user. The default username is [email protected] , and the default password is 5iveL! fe (which you will be prompted to change as soon as you enter it).


Not strictly related to the current scenario. Sometimes when you are prompted for password, it is because you added the wrong* origin format (HTTPS instead of SSH)

HTTP(S) protocol is commonly used for public repos with strong username+pass
SSH authentication is more common for internal projects where you can authenticate with a ssh-key-file and simple pass-phrase
GitLab users are more likely to use the SSH protocol

View your remote info with

git remote -v

If you see HTTP(S) address, this is the command to change it to SSH:

git remote set-url origin [email protected]_domain.com/example-project.git

It prompted me for password.

It shouldn't.
If you have the right public/private key representing a user authorized to access project-x, then gitlab won't ask you for anything.

But that supposes that ssh -vT [email protected] is working first.


The Solution from https://github.com/gitlabhq/gitlab-shell/issues/46 worked for me.

By setting the permissions:

chmod 700 /home/git/.ssh
chmod 600 /home/git/.ssh/authorized_keys

password prompt disappears.


I had this same problem when using a key of 4096 bits:

$ ssh-keygen -t rsa -C "GitLab" -b 4096
$ ssh -vT git@gitlabhost
...
debug1: Offering public key: /home/user/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/user/.ssh/id_dsa
debug1: Trying private key: /home/user/.ssh/id_ecdsa
debug1: Next authentication method: password
git@gitlabhost's password:
Connection closed by host

But with the 2048 bit key (the default size), ssh connects to gitlab without prompting for a password (after adding the new pub key to the user's gitlab ssh keys)

$ ssh-keygen -t rsa -C "GitLab"
$ ssh -vT git@gitlabhost
Welcome to GitLab, Joe User!


This can happen if the host has a '-' in its name. (Even though this is legal according to RFC 952.) (Tested using Git Bash under Windows 10 using git 2.13.2.)

ssh prompts me for a password for any host that happens to have a '-' in its name. This would seem to be purely a problem with ssh configuration file parsing because adding an alias to ~/.ssh/config (and using that alias in my git remote urls) resolved the problem.

In other words try putting something like the following in your C:/Users/{username}/.ssh/config

Host {a}
    User git
    Hostname {a-b.domain}
    IdentityFile C:/Users/{username}/.ssh/id_rsa

and where you have a remote of the form

origin  [email protected]:repo-name.git

change the url to use the following the form

git remote set-url origin git@a:repo-name.git

After adding the new SSH Key in GitLab, check if you have "git" group included in SSHD AllowGroups (for Debian /etc/ssh/sshd_config). If not, add it and restart sshd (systemctl restart ssh).

Test it with ssh -vT [email protected] as suggested above.


My problem was that I had a DNS entry for gitlab.example.com to point to my load balancer. So when I tried command ssh [email protected] I was really connecting to the wrong machine.

I made an entry in my ~/.ssh/config file:

Host gitlab.example.com
    Hostname 192.168.1.50

That wasted a lot of time...