【Git】已经在拉取时以HTTP的URL拉取的仓库使用SSH的URL进行push

添加remote url即可。

添加前:

bash 复制代码
➜  Linux-for-Newbies git:(main) git remote -v
origin  https://github.com/ZhaoCake/Linux-for-Newbies.git (fetch)
origin  https://github.com/ZhaoCake/Linux-for-Newbies.git (push)

添加:

bash 复制代码
git remote add --mirror=push ssh_one git@github.com:ZhaoCake/Linux-for-Newbies.git

添加后:

bash 复制代码
➜  Linux-for-Newbies git:(main) git push ssh_one
The 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])?yyes
Warning: 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 threads
Compressing 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
相关推荐
siqiangming11 小时前
将SVN项目迁移到Git,保留提交记录
git·svn
CCPC不拿奖不改名12 小时前
两种完整的 Git 分支协作流程
大数据·人工智能·git·python·elasticsearch·搜索引擎·自然语言处理
南方者12 小时前
【Sourcetree】【Git】提交后无法推送,优雅回滚
git·版本管理·sourcetree·回滚·贮藏
lpfasd12313 小时前
PyGithub用法详解
git·python·github
一品威客网14 小时前
版本控制(Git):APP协同开发的四大核心基石
大数据·git
007张三丰15 小时前
git中的SSH 公钥配置详细指南(GitHub、GitLab、Gitee平台适用)
git·ssh·github
EverydayJoy^v^15 小时前
RH124简单知识点——第8章——配置和保护SSH
linux·运维·ssh
我寄人间雪满头丶16 小时前
GitHub 私有仓库 SSH 访问配置 SOP(Mac / Windows 通用)
macos·ssh·github
yue00816 小时前
git使用
git
tianlebest17 小时前
git action
大数据·git·elasticsearch