Configure Gitlab SSH non-port 22 port under Window

Source: Internet
Author: User
Tags git client

git config--global user.name"Jack"git config--global User.email"[email protected]"Create a new repositorymkdirFROMAI_CNCD fromai_cngit InitTouchreadme.mdgit Add Readme.mdgit commit-M"First commit"git remote add origin [email protected]:d Evelper/Xxx_cn.gitgit Push-u Origin masterpush an existing Git REPOSITORYCD existing_git_repogit Remote add origin [email protected]:d EVELPER/Xxx_cn.gitgit Push-U Origin Master

This is the configuration above the Gitlab.

Windows installed git client, all Google's address here to provide a http://pan.baidu.com/s/1i3ACfe1

After installation, because the server port SSH is not number 22nd so

First, configure SSH automatic login.

Ssh-keygen -t rsa-c [email protected]

Modify the method to modify the current user's home under the . ssh/config file

Vim ~/.SSH/Confighost ExamplehostnameExample.comport1234modify the. Git under the project file/config file: [core] Repositoryformatversion=0FileMode=falseBare=falselogallrefupdates=truesymlinks=falseignorecase=trueHidedotfiles=Dotgitonly[remote"Origin"] URL= [email protected]:d evelper/Xxxx_cn.git Fetch= +refs/heads/*: refs/remotes/origin/*

Finally, add the public key to the Gitlab

Cat ~/. ssh/id_rsa.pubssh-rsa aaaab3nzac1yc2eaaaabiwaaaqea1b0//onyokn6/ ss2xyummcbys9bnlfuyvhluya9k989juhshhtnaccu+fdnl3xgqbrtfykjr+yhw3bnqqla+oyjc12hoptcgklwwlrouy/ 5dloayatoxk0j4hk91zhinqkfcx0j/1aify9czjwhdaux48dhciqsqskqrpavc/ uonlit5xphr0hjdsi0wblfphtjrlzwoya8fcvwdc93bydhjk3pwscfcalh/69oi1bqqe+wewewexmsnv21+ 4ki5tdmdcgo5gagfyoq38tr2jm9khp1ro+5ekr/tw1qo9z1wjj6phb9dazfl2wnaiggfg1rnb0intqogh+cowbol3/+jbq== [Email Protected
Copy this to Gitlab.
In My SSH keys

git push origin master

========================================================================

2. Specify the saved file name when SSH key is generated
ssh-keygen -t rsa -f ~/.ssh/id_rsa.sohu -C "email"

The above id_rsa.sohu is the name of the file we specified, when the ~/.ssh directory will be more than id_rsa.sohu id_rsa.sohu.pub two files, the id_rsa.sohu.pub store is the key we want to use.

3. Add and configure configFile additions configFile

If config the file does not exist, add it first, and then modify it directly.

touch ~/.ssh/config
In configFile, add the following content ( UserIndicates your user name)
Host *.cloudscape.sohu.com    IdentityFile ~/.ssh/id_rsa.sohu User test
==============================================================================================
#Default Git Host defaultgit    HostName IP Address #域名也可    User think    IdentityFile ~/. ssh /id_rsa #Second Git Host secondgit    HostName IP Address #域名也可    User think    IdentityFile ~/. ssh /id_rsa_second
 

Configure Gitlab SSH non-port 22 port under Window

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: info-contact@alibabacloud.com 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.