github本地仓库push到远程仓库

1.从远程仓库clone到本地

2.生成SSH秘钥,为push做准备

在Ubuntu命令行输入一下内容

bash 复制代码
[root@localhost ~]# ssh-keygen -t rsa       <== 建立密钥对,-t代表类型,有RSA和DSA两种
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):   <==密钥文件默认存放位置,按Enter即可
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):     <== 输入密钥锁码,或直接按 Enter 留空
Enter same passphrase again:     <== 再输入一遍密钥锁码
Your identification has been saved in /root/.ssh/id_rsa.    <== 生成的私钥
Your public key has been saved in /root/.ssh/id_rsa.pub.    <== 生成的公钥
The key fingerprint is:
SHA256:K1qy928tkk1FUuzQtlZK+poeS67vIgPvHw9lQ+KNuZ4 root@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
|           +.    |
|          o * .  |
|        . .O +   |
|       . *. *    |
|        S =+     |
|    .    =...    |
|    .oo =+o+     |
|     ==o+B*o.    |
|    oo.=EXO.     |
+----[SHA256]-----+

最后生产SSH Key的秘钥对, id_rsa 是私钥,不能泄露出去, id_rsa.pub 是公钥,可以放心地告诉任何人。

按这个目录去.ssh目录下找到id_rsa.pub这个文件夹打开复制全部内容。

在github上面添加公钥将上面内容复制到下图位置

输入ssh -T git@github.com,查看SSH公钥密钥是否配置成功,出现下面信息表明成功

3.将更新了的本地仓库push到远程仓库

第一次push时需要先链接远程仓库

后面提交只要输入下面四句命令即可

相关推荐
redreamSo35 分钟前
让AI Agent自动接Issue、写代码、上线:我用200行代码搭了一个全自动开发流水线
人工智能·开源·github
weixin_514253185 小时前
430-aguvis tmux
github
JAVA面经实录9176 小时前
Java开发工程基础完整手册(企业实战完整版)
java·开发语言·git·ci/cd·svn·github·intellij idea
zh_xuan6 小时前
github远程library仓库升级
android·github
本地化文档6 小时前
rust-nomicon-l10n
rust·github·gitcode
Maynor9967 小时前
Codex 中国站正式上线!
人工智能·gpt·macos·github
本地化文档7 小时前
setuptools-docs-l10n
python·github·gitcode
小白依旧白7 小时前
git clone --mirror命令说明
github
是希燃亚7 小时前
hermes迁移手册,将hermes迁移到不同服务器~
后端·github
RxGc7 小时前
# Agent Skills评测:让AI编程工具拥有Google级工程成熟度
人工智能·github