安装Git的步骤(Ubuntu)

1.安装Git

//安装
sudo apt update
sudo apt install git

//查看版本
git --version

2.配置Git

//配置Git的用户名和邮箱地址
git config --global user.name "huoxiaoqiang"
git config --global user.email "237306165@qq.com"

//配置git init命令的默认分支名称
git config --global init.defaultBranch "main"

//查看所有配置
git config --global --list
//查看~/.ssh目录是否已经有SSH老密钥对
ls -al ~/.ssh

//如果没有SSH老密钥对,或者不想使用SSH老密钥对,则可以生成SSH新密钥对
ssh-keygen -t ed25519 -C "237306165@qq.com"

//按三次Enter使用默认配置即可
Enter file in which to save the key (/home/ho/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

//读取SSH新密钥对中的公钥,然后复制粘贴到Gitee
cat ~/.ssh/id_ed25519.pub
//测试SSH新密钥对是否配置成功
ssh -T git@gitee.com

//输入yes使用默认配置即可
Are you sure you want to continue connecting (yes/no/[fingerprint])?

//成功的输出结果
Hi huoxiaoqiang(@huoxiaoqiang)! You've successfully authenticated, but GITEE.COM does not provide shell access.

原创文章,作者:huoxiaoqiang,如若转载,请注明出处:https://www.huoxiaoqiang.com/experience/linux/31999.html

(0)
huoxiaoqiang的头像huoxiaoqiang
上一篇 2023年2月23日 20:26
下一篇 2023年3月2日 00:42

相关推荐

  • Google Chrome浏览器的扩展程序被安装在哪个目录?

    Google Chrome浏览器的扩展程序因不同的操作系统可能会被安装在不同的目录,可通过以下方法查看。 1.在Google Chrome浏览器地址栏中输入chrome://version,然后按Enter回车键。 2.打开上图中”个人资料路径”的路径,该路径下的Extensions目录即默认的…

    Linux经验 2019年12月31日
    010.8K0
  • shebang(hashbang)注释的讲解

    shebang 注释是一种用于在 Unix/Linux shell 中使用的特殊注释,由 #(hash) 和 !(bang) 两个符号开始,后跟脚本的解释器的路径。 shebang 注释又称为 hashbang 注释,更强调符号本身的名称(#! = hash + bang)。 注意:shebang 注释必须放置在脚本文…

    Linux经验 2025年2月24日
    03200
  • 10的正次方与10的负次方的区别

    10^(3) = 10 * 10 * 10 = 1000 10^(-3) = 0.1 * 0.1 * 0.1 = 0.001 所以, 10的N次方等于数字1后跟3个0 10的负N次方等于数字1前3个0,最前面的0后加小数点。

    Linux经验 2021年10月14日
    03.2K0

发表回复

登录后才能评论