1.安装git
问题一: 克隆仓库时报错
- 命令:
sudo opkg install git
git clone https://github.com/xxxxx/xxxx.git
- 报错:
Cloning into 'github.com'...
git: 'remote-https' is not a git command. See 'git --help'.
- 解决方法:
sudo opkg install git-http
问题二:git push 需要使用令牌
- 解决方法:
1.个人账号 登录 Github
2.右上角,用户图标,Settings(设置)
3. 在设置页面,左侧,最后一栏 Developer Settings (开发者设置)
4. 左边 Personal access tokens --> Fine-grained tokens
5. 创建新token: Generate new token
6. 填基本信息:token名,有效时间(最多一年),作用于哪个仓库
7. 权限:只想要 git push,那么只要 Repository权限 的 Contents 设置为 Read and wirte 即可
8. 记得点击最后的 Generate token 按钮
9. 拷贝生成的token 拿去用,它只显示一次,所以要自己保存好
10. 用 https clone 的 库,第一次 git push 时会提示 用户名和密码,其中密码就是 上面的token
参考文章
github 个人令牌