[Turn] windows + gitlab configuration ssh key

windows + gitlab configure ssh key

 

Use ip to access gitlab on the test service, such as http://192.168.3.20/, here with http: // IP.

First, create a new project on gitlab. After clicking to enter, there will be Command line instructions:

Git global setup

git config --global user.name "Administrator"

git config --global user.email "[email protected]"

Create a new repository

mkdir bbscd bbsgit inittouch README.mdgit add README.mdgit commit -m "first commit"git remote add [email protected]:interaction/bbs.gitgit push -u origin master

Push an existing Git repository

cd existing_git_repogit remote add [email protected]:interaction/bbs.gitgit push -u origin master

Two. Configure windows ssh key

   1) If you are Windows and have tortoise installed, then in the tortoise installation directory, such as C: \ Program Files \ TortoiseGit \ bin, there will be a tool puttygen.exe that generates a key pair,

   Open puttygen.exe and click Generate. Note that you need to keep the mouse shaking in the blank area under the progress bar. It will randomly generate a key pair according to the mouse position:

 

2) Copy the above ssh-rsa public key to gitlab, location http: // IP / profile / keys-> add ssh key

 

3) Save private key, generally stored in a directory under C: \ Users \ Administrator \, I put it under .ssh, if there is no such directory, you can build another directory "." At the beginning, just one is enough)

4) Select the private key in the local project

   Note that the project needs to be under git management

  Right-click git setting-> remote-> putty and select the ppk file saved in the previous step.

 

5) Set ssh client: tortoise git-> setting-> network-> ssh client-> TortoiseGitPlink.exe

 

6) When the project git clone and git pull git push, check the autoload putty key, (if the ssh client in the previous step is selected incorrectly, it may be gray and cannot be checked)

 

7) Try the push and pull functions, you should need to enter the password again.

Three, configure linux ssh key

Execute the command: ssh-keygen -t rsa -C "[email protected]" (write your own email here), press Enter all the way to generate the key pair:

 

$cat /root/.ssh/id_rsa.pub

  Copy the public key to gitlab, the operation is the same as the third step of windows.

  carry out.

Guess you like

Origin www.cnblogs.com/liangqihui/p/12760714.html