Loading

gitlab 适配性问题

gitlab适配性问题

构建 ssh-key

ssh-keygen -t rsa -c "my.ad.name@gitlab.9527.com.cn"
# 创建一个自定义名称的 ssh.key
ssh-keygen -t rsa -c "my.ad.name@gitlab.9527.com.cn" -f ~/.ssh/myad.name

cat ~/.ssh/id_rsa.pub
# windows 环境下在 C:/User/Administrator/.ssh
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCv+eSbwD5rcBZwDKYEUBBq2E9ucyBhcmUgbm90IHN0cmljdGx5IHJlcXVpcmVkLCBhbGwgS3ViZXJuZXRlcyBjbHVzdGVycyBzaG91bGQgaGF2ZSBjbHVzdGVyIEROUywgYXMgbWFueSBleGFtcGxlcyByZWx5IG9uIGl0LgoKQ2x1c3RlciBETlMgaXMgYSBETlMgc2VydmVyLCBpbiBhZGRpdGlvbiB0byB0aGUgb3RoZXIgRE5TIHNlcnZlcihzKSBpbiB5b3VyIGVudmlyb25tZW50LCB3aGljaCBzZXJ2ZXMgRE5TIHJlY29yZHMgZm9yIEt1YmVybmV0ZXMgc2VydmljZXMuCgpDb250YWluZXJzIHN0YXJ0ZWQgYnkgS3ViZXJuZXRlcyBhdXRvbWF0aWNhbGx5IGluY2x1ZGUgdGhpcyBETlMgc2VydmVyIGluIHRoZWlyIEROUyBzZWFyY2hlcy4KgGSbkTJiGKlFmAr6MWsk5CLFwv8AKDX9ShShopOtQ5k98agwNjq7lulSLtuULAE= my.ad.name@gitlab.9527.com.cn

构建域名识别文件

cd ~/.ssh/
# 新建一个 config 文件,文件内容如下
Host gitlab.9527.com.cn
    HostName gitlab.info.dbappsecurity.com.cn
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa

gitlab 页面操作

  1. 登录
  2. 右上角人物头像
  3. Edit profile
  4. 左侧 SSH Keys
  5. 在 Key 下面的文本框里填入 id_rsa.pub 文件内的数据
  6. Add key

创建项目目录并配置 git

mkdir myproject
cd myproject
git init 
git config --local user.name "my.ad.name"
git config --local user.email "my.ad.name@9527.com.cn"
git remote add origin git@gitlab.9527.com.cn/myproject/mydevproject.git
git pull 
git checkout master 
posted @ 2021-12-10 16:50  尚墨  阅读(26)  评论(0编辑  收藏  举报