Access Gitlab changed from http to SSH, Gitlab is not using standard 22 port

Source: Internet
Author: User
Tags ssh ssh access git clone

Setup steps:
1, local access. SSH to see if there is a key pair: XXX and
Command: CD ~/.SSH
2, if not present, use Ssh-keygen to create
Command: Ssh-keygen-t rsa-c ""
Example: Ssh-keygen-t rsa-c ""
Enter file in which to save the key by entering directly enter
Enter passphrase (empty for no passphrase) type the password directly enter
Now look at the. SSH directory to see the new pair of keys Id_rsa and
3. View the public key
Command: Cat ~/.ssh/
Copy all, including the following mailbox
4, add to Gitlab
Left column profile settings→ left column ssh keys→ paste and add key
5, create config, Port 22 to ignore this step
Command: Cat>~/.ssh/config
User git
Port 458
Identityfile/home/yourname/.ssh/id_rsa (replace with the path where your Id_rsa is located)

6, change remote
Use Git remote-v to view the URLs of origin and upstream, change HTTP to SSH address, command: Git remote Set-url origin (or upstream) xxxx
For example:
git remote Set-url origin
git remote Set-url upstream

7. Verify that the setting is successful
Command: Ssh-t
Show Welcome to GitLab, yourname! Represents success.

The above summary is HTTP to SSH, if the first clone is SSH access, method see below:

Similarly, the 5th step is to choose whether or not to configure.

The 6th step should read

git clone clone remote repository to local, called Origin

Git remote add upstream adding upstream

Finally, let's summarize the relationship of Fork,origin,upstream:

Become a new member of the project, need to develop on the basis of the original project, fork is to copy the original project to yourself, fork will not be automatically updated, that is, the fork in the last time to stay in the code to copy it the moment.

Origin is your own remote repository

Upstream is used to keep in touch with the original project and update to the latest changes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.