160 字
1 分钟
【Git】已经在拉取时以HTTP的URL拉取的仓库使用SSH的URL进行push
添加remote url即可
添加前:
➜ Linux-for-Newbies git:(main) git remote -vorigin https://github.com/ZhaoCake/Linux-for-Newbies.git (fetch)origin https://github.com/ZhaoCake/Linux-for-Newbies.git (push)添加:
git remote add --mirror=push ssh_one git@github.com:ZhaoCake/Linux-for-Newbies.git添加后:
➜ Linux-for-Newbies git:(main) git push ssh_oneThe authenticity of host 'github.com (20.205.243.166)' can't be established.ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.This key is not known by any other names.Are you sure you want to continue connecting (yes/no/[fingerprint])?yyesWarning: Permanently added 'github.com' (ED25519) to the list of known hosts.Enumerating objects: 6, done.Counting objects: 100% (6/6), done.Delta compression using up to 8 threadsCompressing objects: 100% (4/4), done.Writing objects: 100% (5/5), 2.88 KiB | 46.00 KiB/s, done.Total 5 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)To github.com:ZhaoCake/Linux-for-Newbies.git 1b13d37..3833b61 main -> main * [new reference] origin/HEAD -> origin/HEAD * [new reference] origin/main -> origin/main如何生成SSH公钥,资料很多,不必分享。
ssh-keygen -t rsa 【Git】已经在拉取时以HTTP的URL拉取的仓库使用SSH的URL进行push
https://zhaocake.github.io/posts/2024-4-25/