如何上传github文件,删除文件
1.重点
GitHub 从 2021 年 8 月 13 日起移除了对密码认证的支持。你需要使用个人访问令牌(Personal Access Token, PAT)或 SSH 密钥来进行认证。
2.生成SSH key
进入设置
点击New SSH Key
名字随便取,可以自己方便记
3.上传文件和删除文件
新建仓库,建议直接网站上New1个
点code,然后复制这里
然后终端输入下面,clone到本地(完成后发现会发现本地有新的文件内容)
bash
git clone https://github.com/1920993165/echo.git
配置ssh上传,终端输入下面命令,换为刚才第二步生成的密钥
bash
git remote set-url origin https://<TOKEN>@github.com/1920993165/echo.git
把新文件移到clone下来的文件夹后,add+commit
bash
git add .
git commit -m "add files"
然后push到github
bash
git push
删除文件,直接终端操作
bash
git rm <文件名>
删除文件夹,直接终端操作
bash
git rm -r <文件夹名>
bash
git commit -m "Remove my_folder"
git push