window 下 设置 github ssh

 zongnaxxl240 发布于 2022-10-27 13:54
Administrator@WIN-9PH4ISN44NM MINGW64 /e/zan/www/gitpages
$ cd ~/.ssh

Administrator@WIN-9PH4ISN44NM MINGW64 ~/.ssh
$ ls
github_rsa  github_rsa.pub  id_rsa  id_rsa.pub  known_hosts

Administrator@WIN-9PH4ISN44NM MINGW64 ~/.ssh
$ rm *

Administrator@WIN-9PH4ISN44NM MINGW64 ~/.ssh
$ ls

Administrator@WIN-9PH4ISN44NM MINGW64 ~/.ssh
$ cd ~

Administrator@WIN-9PH4ISN44NM MINGW64 ~
$ ssh-keygen -t rsa -C "root@zanjs.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:gAYTmJ1qwewql+O+7gRm/kquVfseC8cz2WRNA9tCZfM root@zanjs.com
The key's randomart image is:
+---[RSA 2048]----+
| **o   .*.       |
|+oo= . . *       |
|. * o . o E      |
| = o   . + .     |
|ooo .   S .      |
|++ . o =         |
| o+ o B .        |
|oo.. + =         |
|o==. .+          |
+----[SHA256]-----+

Administrator@WIN-9PH4ISN44NM MINGW64 ~/.ssh
$ git config --global user.name "zanjs"

Administrator@WIN-9PH4ISN44NM MINGW64 ~/.ssh
$ git config --global user.email "root@zanjs.com"

$ ssh -T git@github.com
The authenticity of host 'github.com (192.30.252.131)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.131' (RSA) to the list of known hosts.
Enter passphrase for key '/c/Users/Administrator/.ssh/id_rsa':
Hi zanjs! You've successfully authenticated, but GitHub does not provide shell access.

如上 操作 看最后一句话 but GitHub does not provide shell access

这个对 在 git push 的时候有影响吗

6 个回答
  • 不会,因为是windows环境不支持shell,但是不影响git push的使用

    2022-10-28 11:58 回答
  • 下一个 Github 客户端 运行一下就正常了。。

    2022-10-28 11:59 回答
  • 不会影响。
    but GitHub does not provide shell access的意思只是github服务器不提供shell来防止在服务器上进行恶意操作,并不会影响git push

    2022-10-28 12:01 回答
  • 不会影响。參考:
    Git - git-shell Documentation

    DESCRIPTION
    This is a login shell for SSH accounts to provide restricted Git access. It permits execution only of server-side Git commands implementing the pull/push functionality, plus custom commands present in a subdirectory named git-shell-commands in the user’s home directory.

    EXAMPLE
    To disable interactive logins, displaying a greeting instead:

    $ chsh -s /usr/bin/git-shell
    $ mkdir $HOME/git-shell-commands
    $ cat >$HOME/git-shell-commands/no-interactive-login <<\EOF
    #!/bin/sh
    printf '%s\n' "Hi $USER! You've successfully authenticated, but I do not"
    printf '%s\n' "provide interactive shell access."
    exit 128
    EOF
    $ chmod +x $HOME/git-shell-commands/no-interactive-login
    2022-10-28 12:02 回答
  • 推荐使用 GitExtensions

    2022-10-28 12:03 回答
  • ssh-keygen 生成的key 仅仅用于ssh 形式访问 git 远程库,并不能用于shell 下的免用户名密码的快速ssh 登录

    2022-10-28 12:05 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有