gitlab配置上传代码
[root@ecs-6d02 .ssh]# ssh-keygen -t ed25519 -C "gitlab"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/root/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_ed25519.
Your public key has been saved in /root/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:bsZ9gCbMV10CeWFm1bTyM1FQWt86XUDUZoA71ekrf+U gitlab
The key's randomart image is:
+--[ED25519 256]--+
| .o**OO*|
| .=oo.=@|
| ...+o=+|
| o o o o+o|
| + S . .o+o|
| * . . . o+|
| = . . o..|
| o . .E|
| .|
+----[SHA256]-----+
[root@ecs-6d02 .ssh]# cat /root/.ssh/id_ed25519.pub
将生成的公钥配置到用户属性-设置-ssh keys里。
cd existing_repo
git remote add origin git@gitlab.com:itybku/wptest.git
git branch -M main
git push -uf origin main
git clone git@gitlab.com:itybku/wptest.git
root git add *
root git commit -m "wp test"
root git config --global user.email "itybku@gmail.com"
root git config --global user.name "itybku"
root git push -uf origin main
root git commit -m "wp test"
root git push -uf origin main
[root@ecs-6d02 .ssh]# vim config
# GitLab.com
Host gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_ed25519
# Private GitLab instance
Host gitlab.company.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_ed25519
