
(1)在github网站上,找到想要下载的代码仓库界面,点击Code选项就可以看到仓库的git下载地址;
(2)使用命令下载:git clone + 地址;
# 设置邮箱
git config --global user.email "you\@example.com"
# 设置用户名
git config --global user.name "Your Name"
(1)虽然公开的仓库所有人都可以下载,但是不是所有人都有上传代码的权限,必须要得到仓库拥有者的许可才可以上传;
(2)拥有上传权限的方式有三种:直接输入账户名和密码、token方式、ssh key方式;
(3)其中“账户名+密码”的方式已经废弃,本文介绍**令牌(token)**方式,ssh key方式博主没有用过,以后再补充;
# 也可以直接修改.git/config文件
git remote set-url origin https://账户名:密码@github.com/<USERNAME>/<REPO>.git
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
报错原因分析:"账户名+密码"这种方式从2021年开始就不再支持,现在必须使用“token方式、ssh key方式”;更具体的说明可以阅读上面提示的网站;







# 也可以直接修改.git/config文件
git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git


参考博客:《git管理常用命令》;