git 学习笔记

本文介绍如何解决在使用Git克隆远程仓库时遇到的Host key verification failed错误,并演示了从克隆仓库到添加新文件并准备提交的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

git clone下载

git clone下载遇到报错如下
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

linxh@server:~/test$ git clone git@172.16.3.207:lbl_test.git
Cloning into 'lbl_test'...
The authenticity of host '172.16.3.207 (172.16.3.207)' can't be established.
ECDSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? 
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

在这里插入图片描述

在Are you sure you want to continue connecting (yes/no)处打上yes即可

linxh@server:~/test$ git clone git@172.16.3.207:lbl_test.git
Cloning into 'lbl_test'...
The authenticity of host '172.16.3.207 (172.16.3.207)' can't be established.
ECDSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.16.3.207' (ECDSA) to the list of known hosts.
remote: Counting objects: 8, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 8 (delta 1), reused 0 (delta 0)
Receiving objects: 100% (8/8), done.
Resolving deltas: 100% (1/1), done.
Checking connectivity... done.

在这里插入图片描述

git status 查看现状

查看仓库当前的状态,显示有变更的文件。

linxh@server:~/test/lbl_test$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working directory clean

在这里插入图片描述

添加一个新文件“lxh.txt”,git status如下

linxh@server:~/test/lbl_test$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	lxh.txt

nothing added to commit but untracked files present (use "git add" to track)

在这里插入图片描述

git add 后如下

linxh@server:~/test/lbl_test$ git add --all
linxh@server:~/test/lbl_test$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	new file:   lxh.txt

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值