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
config
File additions
config
File
If config
the file does not exist, add it first, and then modify it directly.
touch ~/.ssh/config
In
config
File, add the following content (
User
Indicates 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