当前位置:   article > 正文

GitHub安装(Windows)_github windows

github windows

Git安装

打开Windows PowerShell,输入命令行如下:

winget install --id Git.Git -e --source winget

输入命令行如下:

  1. Windows PowerShell
  2. Copyright (C) Microsoft Corporation. All rights reserved.
  3. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
  4. PS C:\Users\a-xiaobodou> winget
  5. Windows 程序包管理器 v1.3.2691
  6. 版权所有 (C) Microsoft Corporation。保留所有权利。
  7. WinGet 命令行实用工具可从命令行安装应用程序和其他程序包。
  8. 使用情况: winget [<命令>] [<选项>]
  9. 下列命令有效:
  10. install 安装给定的程序包
  11. show 显示包的相关信息
  12. source 管理程序包的来源
  13. search 查找并显示程序包的基本信息
  14. list 显示已安装的程序包
  15. upgrade 显示并执行可用升级
  16. uninstall 卸载给定的程序包
  17. hash 哈希安装程序的帮助程序
  18. validate 验证清单文件
  19. settings 打开设置或设置管理员设置
  20. features 显示实验性功能的状态
  21. export 导出已安装程序包的列表
  22. import 安装文件中的所有程序包
  23. 如需特定命令的更多详细信息,请向其传递帮助参数。 [-?]
  24. 下列选项可用:
  25. -v,--version 显示工具的版本
  26. --info 显示工具的常规信息
  27. 可在此找到更多帮助: https://aka.ms/winget-command-help
  28. PS C:\Users\a-xiaobodou> winget install --id Git.Git -e --source winget
  29. 已找到 Git [Git.Git] 版本 2.38.0
  30. 此应用程序由其所有者授权给你。
  31. Microsoft 对第三方程序包概不负责,也不向第三方程序包授予任何许可证。
  32. Downloading https://github.com/git-for-windows/git/releases/download/v2.38.0.windows.1/Git-2.38.0-64-bit.exe
  33. ██████████████████████████████ 50.8 MB / 50.8 MB
  34. 已成功验证安装程序哈希
  35. 正在启动程序包安装...
  36. 已成功安装
  37. PS C:\Users\a-xiaobodou>

截图:

弹出Git安装程序,自行安装,顺利完成。 

Git设置:

用户名和电子邮件地址设置:

打开“Git Bash”,输入命令行:

  1. git config --global user.name "your_name"
  2. git config --global user.email "your_email_id"

输入命令行的时候,不需要输入双引号。

生成SSH密钥的输入命令行:

ssh-keygen -t rsa -C "your.email@example.com(host name)" 

输入命令行的时候不需要输入双引号。

保存目标路径:密码短语设置,确认密码,都按下三次Enter键。

在此过程中,将生成以下文件

C:\Users\%USERNAME%\.ssh\id_rsa - 密钥(未向任何人显示)
C:\Users\%USERNAME%\.ssh\id_rsa.pub - 公钥(在GitLab等注册)
C:\Users\%USERNAME%\.ssh\config - 通过服务设置SSH密钥
 

 

在Github上,右上角点击头像,弹出拉下菜单,点击“Settings”,点击“SSH and GPG Key”,点击绿色标签“New SSH Key”。

通过记事本打开id_rsa.pub文件,复制,粘贴到GitHub里面New SSH Key。

为了验证是否成功,在git bash下输入命令行:

ssh -T git@github.com

输入命令行如下:

  1. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  2. $ git config --global use.name "douxiaobo"
  3. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  4. $ git config --global user.name "douxiaobo"
  5. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  6. $ git config --global user.email "dxb_1020@icloud.com"
  7. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  8. $ git config --global user.name douxiaobo
  9. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  10. $ git config --global user.email dxb_1020@icloud.com
  11. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  12. $ cd~
  13. bash: cd~: command not found
  14. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  15. $ ssh-keygen -t ras -C dxb_1020@icloud.com -b 4096
  16. unknown key type ras
  17. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  18. $ ssh-keygen -t rsa -C dxb_1020@icloud.com
  19. Generating public/private rsa key pair.
  20. Enter file in which to save the key (/c/Users/a-xiaobodou/.ssh/id_rsa):
  21. Created directory '/c/Users/a-xiaobodou/.ssh'.
  22. Enter passphrase (empty for no passphrase):
  23. Enter same passphrase again:
  24. Your identification has been saved in /c/Users/a-xiaobodou/.ssh/id_rsa
  25. Your public key has been saved in /c/Users/a-xiaobodou/.ssh/id_rsa.pub
  26. The key fingerprint is:
  27. SHA256:Mga6AOy3yodv2X3lQcWK4rI5NQOOLGlpM9QjtRniouk dxb_1020@icloud.com
  28. The key's randomart image is:
  29. +---[RSA 3072]----+
  30. | . |
  31. |.. o o |
  32. |o.+ = . o |
  33. |++ * o . . o |
  34. |=o*.+ * S . |
  35. |oX.+.+ B o |
  36. |+ *.o * o o . |
  37. |.E.+ = . . . |
  38. | o+. . . |
  39. +----[SHA256]-----+
  40. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  41. $ ^C
  42. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  43. $ ssh -T dxb_1020@icloud.com
  44. ssh: connect to host icloud.com port 22: Connection timed out
  45. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  46. $ ssh -T dxb_1020@icloud.com
  47. ssh: connect to host icloud.com port 22: Connection timed out
  48. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  49. $ ssh -T git@githu.com
  50. ssh: connect to host githu.com port 22: Connection timed out
  51. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  52. $ ssh -T git@github.com
  53. The authenticity of host 'github.com (20.205.243.166)' can't be established.
  54. ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
  55. This key is not known by any other names
  56. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
  57. Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
  58. Hi douxiaobo! You've successfully authenticated, but GitHub does not provide shell access.
  59. FAREAST+a-xiaobodou@DESKTOP-3P89ER1 MINGW64 ~
  60. $

截图如下:

 

在Visual Studio Code中使用Git和GitHub

1、在Visual Studio Code中设置Git

点击"File"--"Preferences"--"Settings" 

搜索"gitpath",点击"Edit in settings.json"

 之前:

复制文件地址:

 

粘贴之后:

 

修改地址:四个地方多加\字符

保存之后,重启Visual Studio Code即可。 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/一键难忘520/article/detail/852094
推荐阅读
相关标签
  

闽ICP备14008679号