git生成公钥

2 篇文章 0 订阅

Warning: Permanently added the RSA host key for IP address ‘192.30.252.131’ to the list of known hosts.

Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

出现这个问题是因为,没有在github账号添加SSH key

解决方法如下
win+r cmd 回车

ssh-keygen -t rsa -C “lxw”//注意。lxw为用户名
如果执行成功。返回:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/lxw/.ssh/id_rsa):

在这里就是设置存储地址了.反正我是直接按的回车
然后返回:
Enter passphrase (empty for no passphrase):

再次直接回车
Enter same passphrase again:

再次回车。
Your identification has been saved in /home/lxw/.ssh/id_rsa.
Your public key has been saved in /home/forwhat.cn/.ssh/id_rsa.pub.
The key fingerprint is:

我是一直回车
SSH key就生成了 就在电脑

在这里插入图片描述

将它粘帖到github帐号管理中的添加SSH key界面中。

还有一种方法
执行生成命令 : ssh-keygen

期间会提示你输入邮箱、密码(邮箱密码)直接输入就ok ,成功之后会在一个文件夹下生成一个私钥 id_rsa和一个公 钥 id_rsa.pub(放在服务器上)

我也没试 有兴趣的可以用下

git日常操作

  git init 初始化文件夹为git管理
     git clone 拉取远程代码
     git status 查看文件工作区状态
     git diff 查看修改 git diff filename 查看文件修改
     git add . 添加所有修改文件到暂存区 git add filename 添加单个文件到暂存区
     git commit -m"备注信息"
     git push 推送到远程
     git pull 拉取远程代码 
     git checkout -- filename 放弃工作区文件修改
     git reset HEAD  - filename  放弃暂存区(add)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

罗小稳

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值