1.安装Git的步骤(Ubuntu)

1.安装Git

//安装Git
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/linux/git/31999.html

(0)
huoxiaoqiang的头像huoxiaoqiang
上一篇 2023年2月23日
下一篇 2023年3月2日

相关推荐

  • 3.Git的区域和状态

    区域 状态 非工作区 未跟踪(Untracked) 工作区(Working Directory) 未修改(Unmodified)已修改(Modified) 暂存区(Staging Area) 已暂存(Staged) 本地仓库(Repository) 已提交(Committed) 远程仓库(Remote) ———————…

    Git教程 2023年3月3日
    01580
  • 2.Git常用命令一览表

    1.git 命令 描述 git –help 查看git帮助 git help <command> 或git <command> –help 查看git指定命令帮助 git –version 查看git版本 git -C <path> <command> 在指定路径下…

    Git教程 2023年3月2日
    01480
  • 4..gitignore文件的模式匹配规则

    模式 匹配 空行 空行不匹配任何目录或文件。 # 以 # 开头的行作为注释。 foo 匹配任何目录中名称为 foo 的目录或文件。同模式 **/foo。 foo/ 匹配任何目录中名称为 foo 的目录。同 **/foo/。 foo.txt 匹配任何目录中名称为 foo.txt 的文件。同 **/fo…

    Git教程 2023年3月4日
    01230

发表回复

登录后才能评论