# A1. Git 下载和安装
Git 是一个免费的开源分布式版本控制系统,旨在处理从小到 具有速度和效率的超大型项目。Git 易于学习,占用空间小,性能优异。
# 1. Debian/Ubuntu
安装Git最快的方法是采用宏包管理器。当然,也可以在kernel.org找到源码压缩包,最新版本为 2.43.0。
For the latest stable version for your release of Debian/Ubuntu
# apt-get install git
1
For Ubuntu, this PPA provides the latest stable upstream Git version
# add-apt-repository ppa:git-core/ppa # apt update; apt install git
1
# 2. Windows
单击此处下载 (opens new window)最新的 64 位版本 Git for Windows (2.43.0)。这是最近维护的版本。
# 3. 设置账号的缺省身份标识
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
1
2
2
# 4. 生成ssh上传服务器密码
ssh-keygen -t rsa -C "you@example.com"
1
密码也是Git的deploy key,将保存在本地/home/用户id/.ssh/id_rsa.pub 文件中。在Github中【Setting】-【Deploy】中添加该密码后,就可以测试连通情况了。
$ ssh -T git@github.com
Hi username/username.github.io! You've successfully authenticated, but GitHub does not provide shell access.
1
2
2
则表明连接成功,可以上传当地仓库到Github了。上面的username是你在Github的用户名!