github使用

axing
2026-02-12 / 0 评论 / 3 阅读 / 正在检测是否收录...

mlj9bwx6.png

#github里面没有添加该节点的公钥
root@harbor-ops:~/ax_pan# ssh -T git@github.com
git@github.com: Permission denied (publickey).
#解决办法添加公钥给github
root@harbor-ops:~/ax_pan# ls -al ~/.ssh
total 28
drwx------  2 root root 4096 Feb  5 11:11 .
drwx------ 20 root root 4096 Feb 12 17:04 ..
-rw-------  1 root root    0 Nov 16 22:23 authorized_keys
-rw-r--r--  1 root root  115 Dec 13 17:16 config
-rw-------  1 root root  399 Dec 13 17:06 id_ed25519
-rw-r--r--  1 root root   88 Dec 13 17:06 id_ed25519.pub
-rw-------  1 root root 4054 Feb 12 17:05 known_hosts
-rw-------  1 root root 3076 Feb  5 11:11 known_hosts.old

root@harbor-ops:~/ax_pan# cat /root/.ssh/id_ed25519.pub
ssh-ed25519 XXXX/ gitlab

mlj9dpiv.png
mlj9dxeo.png

#成功
root@harbor-ops:~/ax_pan# ssh -T git@github.com
Hi axingzys! You've successfully authenticated, but GitHub does not provide shell access.
root@harbor-ops:~/ax_pan# 
root@harbor-ops:~/ax_pan/ax_pan_server# git remote -v
origin  https://github.com/axingzys/fast_gin_v2.git (fetch)
origin  https://github.com/axingzys/fast_gin_v2.git (push)
root@harbor-ops:~/ax_pan/ax_pan_server# git remote remove origin
root@harbor-ops:~/ax_pan/ax_pan_server# git remote -v
root@harbor-ops:~/ax_pan/ax_pan_server# 

mlj9nyqg.png

#新创建项目

mlj9q0x6.png

mlj9s93f.png

root@harbor-ops:~/ax_pan/ax_pan_server# git branch
* main
#我们本来就是main就不用做git branch -M main
#下面就会把代码到新的仓库
root@harbor-ops:~/ax_pan/ax_pan_server# git remote add origin https://github.com/axingzys/axpan_server.git
git push -u origin main
Enumerating objects: 348, done.
Counting objects: 100% (348/348), done.
Delta compression using up to 4 threads
Compressing objects: 100% (181/181), done.
Writing objects: 100% (348/348), 60.23 KiB | 60.23 MiB/s, done.
Total 348 (delta 123), reused 348 (delta 123), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (123/123), done.
To https://github.com/axingzys/axpan_server.git
 * [new branch]      main -> main
branch 'main' set up to track 'origin/main'.
0

评论 (0)

取消