ssh免密登陆与git详解

这篇具有很好参考价值的文章主要介绍了ssh免密登陆与git详解。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

目录

ssh免密登陆

利用root账号密码登录ssh服务端

利用root账号免密登录ssh服务端

利用非root账号免密登录ssh服务端

处理git用户的shell为git-shell

出现的问题

git详细教程

搭建git本地服务器

配置ssh远程访问

创建git本地仓库

git clone与git pull的区别 

git如何拉取指定分支的代码

git fetch与git merge


ssh免密登陆


参考文章:http://blog.itpub.net/70017844/viewspace-2909916/
linux系统CentOS Linux release 7.9.2009 (Core)
zabbix-server    192.168.220.128
zabbix-proxy     192.168.220.108

利用root账号密码登录ssh服务端

1.zabbix-server开启ssh服务
[root@zabbix-server ~]# rpm -qf `which ssh`
openssh-clients-7.4p1-21.el7.x86_64
[root@zabbix-server ~]# rpm -qf `which sshd`
openssh-server-7.4p1-21.el7.x86_64
[root@zabbix-server ~]# systemctl status sshd
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2023-04-20 22:35:42 EDT; 4h 27min ago
     Docs: man:sshd(8)
           man:sshd_config(5)
 Main PID: 2563 (sshd)
   CGroup: /system.slice/sshd.service
           └─2563 /usr/sbin/sshd -D
........

2.zabbix-proxy账号密码登录zabbix-server
[root@zabbix-proxy ~]# ssh root@192.168.220.128
The authenticity of host '192.168.220.128 (192.168.220.128)' can't be established.
ECDSA key fingerprint is SHA256:WWjD+PCmlUmq2jJJF32DbaHWE32uVKO/h66k32jf9Ns.
ECDSA key fingerprint is MD5:92:ea:a5:d4:a6:ad:10:de:97:a5:bd:4f:67:ce:87:d6.
Are you sure you want to continue connecting (yes/no)? yes    ####输入yes后会添加一条192.168.220.128的信息到客户端~/.ssh下的known_hosts文件
Warning: Permanently added '192.168.220.128' (ECDSA) to the list of known hosts.
root@192.168.220.128's password: 
Last login: Thu Apr 20 23:34:23 2023 from 192.168.220.1
[root@zabbix-server ~]# 


客户端
[root@zabbix-proxy ~]# cat known_hosts 
192.168.220.125 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBE7++JhhOslmX5T1/B2knqMR84TycWTSLUyQ2HYpoKMnKtVm2oqDhQuGksf19KjFHYxB7jFT4wpkAHGBwst8RtY=
192.168.220.128 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBE7++JhhOslmX5T1/B2knqMR84TycWTSLUyQ2HYpoKMnKtVm2oqDhQuGksf19KjFHYxB7jFT4wpkAHGBwst8RtY=

利用root账号免密登录ssh服务端

###手动复制客户端公钥到服务端authorized_keys文件内实现免密登录的方式有时候不好用,强烈建议使用ssh-copy-id命令
[root@zabbix-proxy ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
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:Hb3aqAwQvPhc4nL1Tf8beXzvL4coAMrtMn7Q4dgVPbc root@zabbix-proxy
The key's randomart image is:
+---[RSA 2048]----+
|         .       |
|   .    . o..    |
|    o    ..o..   |
|   . oo .. .E.   |
|  ..+Bo+S o .    |
|   +===..o =   o |
|  . =o. ..+ o.o.+|
|   oo oo .. ..oo+|
|   ..+  o  .  o==|
+----[SHA256]-----+
将/root/.ssh/id_rsa.pub的内容复制到服务端zabbix-server下的/root/.ssh/authorized_keys文件内        ###将ssh客户端公钥复制到服务端
[root@zabbix-proxy .ssh]# ssh root@192.168.220.128       ###客户端实现免密登录
Last login: Fri Apr 21 03:05:43 2023 from 192.168.220.108
[root@zabbix-server ~]# 

或者通过公钥拷贝指令# ssh-copy-id username@ip
###ssh-copy-id命令会在username用户家目录下创建.ssh/authorized_keys文件,文件内容为免密登录客户机的公钥信息
[root@zabbix-proxy ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
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:Hb3aqAwQvPhc4nL1Tf8beXzvL4coAMrtMn7Q4dgVPbc root@zabbix-proxy
The key's randomart image is:
+---[RSA 2048]----+
|         .       |
|   .    . o..    |
|    o    ..o..   |
|   . oo .. .E.   |
|  ..+Bo+S o .    |
|   +===..o =   o |
|  . =o. ..+ o.o.+|
|   oo oo .. ..oo+|
|   ..+  o  .  o==|
+----[SHA256]-----+
[root@zabbix-proxy .ssh]# ssh-copy-id root@192.168.220.128
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.220.128's password:         #此处输入密码登录服务端

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@192.168.220.128'"
and check to make sure that only the key(s) you wanted were added.

[root@zabbix-proxy .ssh]# ssh 'root@192.168.220.128'
Last login: Fri Apr 21 03:20:32 2023 from 192.168.220.108
[root@zabbix-server ~]# 
[root@zabbix-server ~]# 

利用非root账号免密登录ssh服务端

ssh服务端
[root@zabbix-server .ssh]# useradd -m git
[root@zabbix-server .ssh]# passwd git
Changing password for user git.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@zabbix-server .ssh]# mkdir -p /home/git/.ssh/
[root@zabbix-server .ssh]# vi /home/git/.ssh/authorized_keys    ###将ssh客户端公钥添加到服务端/home/git/.ssh/authorized_keys文件内
[root@zabbix-server .ssh]# chown -R git. /home/git/.ssh/        #重点在修改文件的属性和权限,否则ssh git@192.168.220.128,任然会提示输入git用户密码
[root@zabbix-server .ssh]# chmod -R 700 /home/git/.ssh/
ssh客户端通过非root用户连接服务端
[root@zabbix-proxy .ssh]# ssh git@192.168.220.128
git@192.168.220.128's password: 
[git@zabbix-server ~]$ 
[git@zabbix-server ~]$ 
或者通过公钥拷贝指令ssh-copy-id
ssh服务端
[root@zabbix-server .ssh]# useradd -m git
[root@zabbix-server .ssh]# passwd git
Changing password for user git.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@zabbix-server git]# ls -l /home/git/.ssh/authorized_keys    #git用户目录下没有此文件下面用ssh-copy-id命令生成
ls: cannot access /home/git/.ssh/authorized_keys: No such file or directory
ssh客户端通过非root用户连接服务端
[root@zabbix-proxy ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
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:Hb3aqAwQvPhc4nL1Tf8beXzvL4coAMrtMn7Q4dgVPbc root@zabbix-proxy
The key's randomart image is:
+---[RSA 2048]----+
|         .       |
|   .    . o..    |
|    o    ..o..   |
|   . oo .. .E.   |
|  ..+Bo+S o .    |
|   +===..o =   o |
|  . =o. ..+ o.o.+|
|   oo oo .. ..oo+|
|   ..+  o  .  o==|
+----[SHA256]-----+
[root@zabbix-proxy ~]# ssh-copy-id git@192.168.220.128
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
git@192.168.220.128's password:         #输入git密码

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'git@192.168.220.128'"
and check to make sure that only the key(s) you wanted were added.

[root@zabbix-proxy ~]# ssh git@192.168.220.128
Last login: Fri Apr 21 04:20:12 2023 from 192.168.220.108
[git@zabbix-server ~]$ 

ssh服务端
[root@zabbix-server ~]# ls -l /home/git/.ssh/authorized_keys        ##可以看到公钥被拷贝到authorized_keys文件内
-rw------- 1 git git 399 Apr 21 04:19 /home/git/.ssh/authorized_keys

处理git用户的shell为git-shell

在Git用作仓库的时候我们可以将默认ssh登录shell改为git-shell,这个git提供的shell程序,一旦登录会自动秒退  #为了安全考虑我们需要禁用ssh登录到我们的shell,防止别人登录到shell之后对我们的电脑做增删改
ssh服务器
[root@zabbix-server git]# chsh -s `which git-shell` git
Changing shell for git.
chsh: Warning: "/usr/bin/git-shell" is not listed in /etc/shells.
Shell changed.
ssh客户端
[root@zabbix-proxy ~]# ssh git@192.168.220.128
git@192.168.220.128's password: 
Last login: Fri Apr 21 04:23:57 2023 from 192.168.220.108
fatal: Interactive git shell is not enabled.
hint: ~/git-shell-commands should exist and have read and execute access.
Connection to 192.168.220.128 closed.
[root@zabbix-proxy ~]# 

出现的问题

问题1:由于用户git在服务器端的 shell 为 git-shell,在使用 ssh-copy-id 的时候报错:
[root@zabbix-proxy test]# ssh-copy-id git@192.168.220.128
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
git@192.168.220.128's password: 
fatal: unrecognized command 'exec sh -c 'cd ; umask 077 ; mkdir -p .ssh && cat >> .ssh/authorized_keys || exit 1 ; if type restorecon >/dev/null 2>&1 ; then restorecon -F .ssh .ssh/authorized_keys ; fi''
解决办法
[root@zabbix-proxy .ssh]# scp /root/.ssh/id_rsa.pub root@192.168.220.128:/home/git/.ssh/authorized_keys   #确保ssh服务器/home/git/.ssh/目录存在,scp是ssh的文件复制命令   
id_rsa.pub                                                     100%  399   373.5KB/s   00:00   
[root@zabbix-proxy .ssh]# ssh root@192.168.220.128
Last login: Fri Apr 21 04:12:25 2023 from 192.168.220.108
[root@zabbix-server ~]# cd /home/git/
[root@zabbix-server git]# chown -R git. .ssh
[root@zabbix-server git]# chmod -R 700 .ssh/
[root@zabbix-server git]# ll /home/git/.ssh/
total 4
-rwx------ 1 git git 399 Apr 21 05:35 authorized_keys
 

git详细教程

Git 分支管理 | 菜鸟教程
关于Git这一篇就够了_17岁boy想当攻城狮的博客-CSDN博客
Git简明指南:git 简明指南

搭建git本地服务器

参考文章:https://huaweicloud.csdn.net/63560ddfd3efff3090b5909f.html?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Eactivity-1-124420970-blog-126617355.235%5Ev31%5Epc_relevant_increate_t0_download_v2&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Eactivity-1-124420970-blog-126617355.235%5Ev31%5Epc_relevant_increate_t0_download_v2&utm_relevant_index=1

环境
[root@zabbix-server ~]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
zabbix-server    192.168.220.128
zabbix-proxy     192.168.220.108
分别已安装软件  yum install git ssh -y;service ssh start 

配置ssh远程访问

zabbix-server服务端
[root@zabbix-server ~]# useradd -m git
[root@zabbix-server ~]# passwd git       #给git用户设置密码
Changing password for user git.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.
zabbix-proxy客户端
[root@zabbix-proxy ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
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:fmDBtjmOjnHxy/HOhtT4+PcvyZ91533TbelGyo8n5Sw root@zabbix-proxy
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|       .         |
|        +        |
|       . +       |
|      . So       |
|       Boo.    o |
|    . o.=+. ..*.B|
|     = .o*o .E=O@|
|    . . o+=. oOOB|
+----[SHA256]-----+
[root@zabbix-proxy ~]# ssh-copy-id git@192.168.220.128
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
git@192.168.220.128's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'git@192.168.220.128'"
and check to make sure that only the key(s) you wanted were added.

[root@zabbix-proxy ~]# ssh 'git@192.168.220.128'                  #免密访问
Last failed login: Fri Apr 21 05:05:04 EDT 2023 from 192.168.220.108 on ssh:notty
There was 1 failed login attempt since the last successful login.
[git@zabbix-server ~]$ 
zabbix-server服务端
[root@zabbix-server .ssh]# chown -R git. /home/git/.ssh/
[root@zabbix-server .ssh]# chmod -R 700 /home/git/.ssh/
[root@zabbix-server .ssh]# chsh -s `which git-shell` git               #修改git用户的shell,防止客户机ssh通过git用户登录服务器修改文件
Changing shell for git.
chsh: Warning: "/usr/bin/git-shell" is not listed in /etc/shells.
Shell changed.

创建git本地仓库

zabbix-server服务端
创建仓库存放路径并设置所属用户为git,路径可任意起名,这里叫gitrepo。
[root@zabbix-server .ssh]# mkdir -p /home/git/gitrepo
初始化仓库并设置所属用户为git,这里建了一个叫test的仓库。
root@zabbix-server .ssh]# cd /home/git/gitrepo/
[root@zabbix-server gitrepo]# git init --bare test.git
Initialized empty Git repository in /home/git/gitrepo/test.git/
[root@zabbix-server gitrepo]# chown -R git. /home/git/gitrepo/          ##因为这里的gitrepo路径下有多个文件,所以加-R参数递归
到此,git服务器就算搭建完成,URL地址如下:
git@192.168.220.128:/home/git/gitrepo/test.git

测试1 --git clone
以下简单测试Clone和Push,如果你之前用过git,那么得到上边的仓库地址后应该就非常熟悉了。
clone--zabbix-proxy客户端
[root@zabbix-proxy ~]# mkdir -p $HOME/A
[root@zabbix-proxy ~]# cd A/
[root@zabbix-proxy A]# git clone git@192.168.220.128:/home/git/gitrepo/test.git   #这里并不需要输入上边创建git用户的密码,如果需要输入密码,说明公钥添加有误,请重新检查。
Cloning into 'test'...
warning: You appear to have cloned an empty repository.
[root@zabbix-proxy A]# ls
test
[root@zabbix-proxy A]# cd test
[root@zabbix-proxy test]# ls
[root@zabbix-proxy test]# touch 1
[root@zabbix-proxy test]# git add .
[root@zabbix-proxy test]# git commit -m "ceshi"
[master (root-commit) e3b8d5b] ceshi
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 1
[root@zabbix-proxy test]# git push origin master      #通过克隆来的远程仓库,默认有个别名叫origin,所以推送可以直接这样:
Counting objects: 3, done.
Writing objects: 100% (3/3), 193 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@192.168.220.128:/home/git/gitrepo/test.git
 * [new branch]      master -> master
[root@zabbix-proxy test]# mkdir -p $HOME/B             #再次克隆
[root@zabbix-proxy test]# cd $HOME/B
[root@zabbix-proxy B]# git clone git@192.168.220.128:/home/git/gitrepo/test.git
Cloning into 'test'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
[root@zabbix-proxy B]# ls
test
[root@zabbix-proxy B]# cd test
[root@zabbix-proxy test]# ls               #可以看到这个就是刚才提交文件
1

测试2 --git remote   #需要有本地仓库
[root@zabbix-proxy ~]# mkdir -p $HOME/C
[root@zabbix-proxy ~]# cd $HOME/C        
[root@zabbix-proxy C]# git init        #初始化创建本地仓库
Initialized empty Git repository in /root/C/.git/
[root@zabbix-proxy C]# git remote add origin git@192.168.220.128:/home/git/gitrepo/test.git       #git远程添加源
[root@zabbix-proxy C]# git push -u origin master    #将本地的master分支推送到origin主机,同时指定origin为默认主机
error: src refspec master does not match any.
error: failed to push some refs to 'git@192.168.220.128:/home/git/gitrepo/test.git'
[root@zabbix-proxy C]#  git pull git@192.168.220.128:/home/git/gitrepo/test.git    ##在上传你的代码之前因为产生冲突会报错,提交不上,通常要进行拉取代码。
remote: Counting objects: 26, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 26 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (26/26), done.
From 192.168.220.128:/home/git/gitrepo/test
 * branch            HEAD       -> FETCH_HEAD
[root@zabbix-proxy C]# ls
1  README  runoob.php  test.txt
[root@zabbix-proxy C]# git branch
* master
[root@zabbix-proxy C]# echo 1111111 >ceshi
[root@zabbix-proxy C]# git add .
[root@zabbix-proxy C]# git commit -m "add ceshi"
[master 6e0e239] add ceshi
 1 file changed, 1 insertion(+)
 create mode 100644 ceshi
[root@zabbix-proxy C]# git push -u origin master    ##将本地的master分支推送到origin主机,同时指定origin为默认主机
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 257 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To git@192.168.220.128:/home/git/gitrepo/test.git
   0e88423..6e0e239  master -> master
Branch master set up to track remote branch master from origin.
[root@zabbix-proxy C]# 

git clone与git pull的区别 

git clone与git pull区别_git pull能用什么代替_zhou_xiaomiao的博客-CSDN博客
git上传_提交代码前先git pull吗_年少不知富婆好的博客-CSDN博客

git如何拉取指定分支的代码

问题背景:

  新项目还在开发阶段,没有正式对外发布,所以开发同事合并代码到develop上(或者其他名称分支上),而不是到master分支上

  通过git拉取代码的时候,默认拉取的是master分支,如下图:

git@192.168.0.188's password:,ssh,服务器,linux

拉取指定分支代码解决方案:

以拉取develop分支的代码为例, 要拉取其余分支代码类似操作

1.使用git命令拉取

命令:git clone -b develop XXX 其中develop就是分支的名称

git@192.168.0.188's password:,ssh,服务器,linux

2.使用TortoiseGit工具拉取 

git@192.168.0.188's password:,ssh,服务器,linux

git fetch与git merge

参考内容:Git 远程仓库(Github) | 菜鸟教程文章来源地址https://www.toymoban.com/news/detail-766198.html

  • 执行 git fetch origin master 时,它的意思是从名为 origin 的远程上拉取名为 master 的分支到本地分支 origin/master 中。既然是拉取代码,当然需要同时指定远程名与分支名,所以分开写。
  • 执行 git merge origin/master 时,它的意思是合并名为 origin/master 的分支到当前所在分支。既然是分支的合并,当然就与远程名没有直接的关系,所以没有出现远程名。需要指定的是被合并的分支。
  • 执行 git push origin master 时,它的意思是推送本地的 master 分支到远程 origin,涉及到远程以及分支,当然也得分开写了。
  • 还可以一次性拉取多个分支的代码:git fetch origin master stable oldstable
  • 也还可以一次性合并多个分支的代码:git merge origin/master hotfix-2275 hotfix-2276 hotfix-2290
服务器A
[root@dongm xuexi]# ls
11111  1.txt  ceshi.c  ceshi.ccccccc  ceshi.sh  test.c  test.txt  xinjian.txt
[root@dongm xuexi]# echo  555555 >11111111111.txt
[root@dongm xuexi]# git add .
[root@dongm xuexi]# git commit -m "add 1111111111.txt"
[master c3d767b] add 1111111111.txt
 1 file changed, 1 insertion(+)
 create mode 100644 11111111111.txt
[root@dongm xuexi]# git push origin master
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 260 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To git@github.com:dongmin6/test.git
   3f7513d..c3d767b  master -> master        ##增加文件11111111111.txt
[root@dongm xuexi]# ls
11111  11111111111.txt  1.txt  ceshi.c  ceshi.ccccccc  ceshi.sh  test.c  test.txt  xinjian.txt



服务器B
[root@dongm test]# git fetch origin
From github.com:dongmin6/test
   3f7513d..c3d767b  master     -> origin/master     ##与仓库新增文件11111111111.txt对应
[root@dongm test]# ls
11111  1.txt  ceshi.c  ceshi.ccccccc  ceshi.sh  README.md  test.c  test.txt  xinjian.txt
[root@dongm test]# git merge origin/master
Merge made by the 'recursive' strategy.
 11111111111.txt | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 11111111111.txt
[root@dongm test]# ls
11111  11111111111.txt  1.txt  ceshi.c  ceshi.ccccccc  ceshi.sh  README.md  test.c  test.txt  xinjian.txt

到了这里,关于ssh免密登陆与git详解的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 华为路由器192.168.3.1登陆网址打不开怎么办

    “华为路由器登录地址192.168.3.1打不开怎么解决?”最近看到网上有不少网友遇到华为路由器登录地址192.168.3.1打不开的现象,其实引起这种现象的因素是有很多种的。比如说,路由器安装出错,电脑IP地址设置不对等等。为了更好的帮助大家,在这里我们总结了引起192.168.3

    2024年02月06日
    浏览(54)
  • 输入192.168.1.1登陆页面打不开进不去的解决方法

    路由器使用环境问题: 一般要用到路由器上网的环境应该是家庭有两台电脑或者宿舍一起共享上网,公司内网IP不够等几种情况!首先我们面对的不是路由器设置问题,而是路由器登录问题。正确登陆了路由器才能进行设置,所以登陆是我们所有使用路由器的人需要首先解决

    2024年02月07日
    浏览(44)
  • Python武器库开发-武器库篇之Git创建远程仓库和建立SSH key 免密登陆(三十七)

    Git是一种版本控制系统,用于跟踪文件的更改和协调多人开发项目。它可以记录文件的历史更改,协助多人协作开发,并提供分支管理功能。Git是一个分布式系统,意味着每个人在自己的本地计算机上都有一份完整的代码仓库,并且可以独立地进行工作。它具有速度快、灵活

    2024年02月02日
    浏览(50)
  • Mac使用SSH 免密登陆(踩坑)

    今天使用mac进行ssh免密登陆,期间遇到了一些问题,mac和windows的操作步骤有点不一样。踩了个坑~! ssh 登录分两种,一种是基于口令(账号密码),另外一种是基于密钥的方式。 基于口令,就是每次登录输入账号和密码,显然这样做是比较麻烦的,这里是介绍如何基于密钥

    2024年02月04日
    浏览(50)
  • Linux多机SSH免密登陆配置

    服务器: 192.168.33.71 、 192.168.33.72 、 192.168.33.73 环境: CentOS 7 配置环境目录: /root/.ssh 1、配置 192.168.33.71 服务器 设置服务器名称 配置 /etc/hosts 文件 2、配置 192.168.33.72 服务器 设置服务器名称 配置 /etc/hosts 文件 3、配置 192.168.33.73 服务器 设置服务器名称 配置 /etc/hosts 文件

    2024年01月19日
    浏览(47)
  • 解决SSH连接报错:Unable to negotiate with 192.168.xx.xx port 22

    遇到SSH连接报错:无法协商匹配的密钥交换方法时,解决方法是手动配置本地SSH客户端以指定特定的密钥交换算法。学习如何通过修改SSH配置文件解决这一问题。

    2024年02月11日
    浏览(146)
  • 怎么取消代理服务器设置解决192.168.1.1打不开的情况

    笔者在上一节中曾讲到 192.168.1.1打不开是怎么回事 ,该文中就涉及到因为代理服务器设置而导致 192.168.1.1打不开 或进不去的情况。那既然是因为代理服务器的问题,那我们该如何取消代理服务器设置呢? 1、双击桌面IE选项,在弹出的IE浏览器中,选择”工具”---“Internet选项

    2024年02月06日
    浏览(52)
  • 作业:通过两台linux主机配置ssh实现互相免密登陆

    做题步骤 : 一.开启两个Linux主机,并且用ssh连接,要能够ping通 我这里是server:192.168.81.129 client:192.168.81.130 举例 操作如下: 二.在客户端上创建一对密钥 1. 注意:可以看到这对密钥是放在/root/.ssh/id_rsa.pub文件下的,公钥的名字是id_rsa.pub 2.查看一下密钥对 [root@client ~]# ll

    2024年01月17日
    浏览(41)
  • 【Linux】服务器免密登陆

    由于专业要求,我需要经常通过 VSCode、Terminal 等工具连接远程服务器开展工作。而每次连接都需要输入一次或多次密码无疑影响了工作体验。基于该背景,本文介绍了免密登陆远程服务器的方式。 根据自己的邮箱地址,利用命令: 生成自己的 id_rsa.pub 文件。此时,对于 Ma

    2024年02月19日
    浏览(45)
  • 解决Linux root用户设置ssh免密登陆后仍然需要输入密码的问题

    搭建hadoop集群后,设置ssh免密登录发现还是一直需要输入密码,简直是烦死了,很明显就是ssh免密登录没有设置好. 出现该问题有很多原因,比如ssh配置不对或者路径权限不对等等 配置方法见 : SSH设置无密码连接 解决方法如下: 重新添加 公钥 更改 ssh 配置文件 更改对应的文件夹和

    2024年02月12日
    浏览(68)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包