安装 Git
安装
sh
sudo apt install git-all
配置全局用户名和邮箱
sh
git config --global user.name "<username>"
git config --global user.email "<email>"
安装 GitHub CLI
sh
conda install gh --channel conda-forge
See: cli/cli: GitHub's official command line tool
登录
sh
gh auth login
选项如下:
sh
? What account do you want to log into? # GitHub.com
? What is your preferred protocol for Git operations on this host? # HTTPS
? Authenticate Git with your GitHub credentials? # Yes
? How would you like to authenticate GitHub CLI? # Login with a web browser
最后一步需要打开浏览器登录:
- https://github.com/login/device
- 输入8位一次性验证代码即可
See: Caching your GitHub credentials in Git - GitHub Docs
配置代理
sh
git config --global http.proxy "http://127.0.0.1:11111"
git config --global https.proxy "http://127.0.0.1:11111"
See: Configure Git to use a proxy
安装 Git LFS
Installing Git Large File Storage - GitHub Docs
git-lfs/git-lfs: Git extension for versioning large files
git-lfs/INSTALLING.md at main · git-lfs/git-lfs
Ubuntu
配置包管理器:
sh
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
安装 git-lfs:
sh
sudo apt-get install git-lfs
查看版本:
sh
git lfs -v