2

When I create a new blank project in gitlab.com, I see git remote add origin git@gitlab.com:my-group1069/test-project.git in the command line instructions page.

I'm curious about why is it not git remote add origin mygitlabaccount@gitlab.com:my-group1069/test-project.git.

enter image description here

cd existing_folder
git init --initial-branch=main
git remote add origin git@gitlab.com:my-group1069/test-project.git
git add .
git commit -m "Initial commit"
git push -u origin main

I think I should interact with gitlab with my gitlab account, not the git user.

Where does the git user come from?

Is it a built-in gitlab user?

Brian
  • 12,145
  • 20
  • 90
  • 153
  • 2
    There is a similar question on Github. I think Gitlab uses "git" as the ssh username for the same reason. https://stackoverflow.com/questions/47664768/why-does-git-using-ssh-use-git-as-a-username – ElpieKay Oct 18 '22 at 04:02
  • @ElpieKay That actually looks like a straight duplicate to me - one of the answers mentions Gitlab, and the other is basically just using Github as an example. – IMSoP Oct 18 '22 at 08:00

1 Answers1

3

SSH is there to authenticate you through your registered SSH public key you registered to your GitLab account.

It is not there to open a remote shell with your "account": said account does not exist as a system user on the remote system. It (mygitlabaccount) only exists as an application account, an entry in the GitLab application.

Only the service (technical) account git does exist on the remote server.
And that one service account will refuse to open an interactive session. It will only allow to execute vetted commands (git clone/push/pull/ls-remote/...).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250