【解决】CICD、GitHub actions workflow新建仓库push时报错could not read Username for

git报错

fatal: could not read Username for 'https://github.com': No such device or address

原因是没有GitHub token,而且cicd时无法输入用户密码

正常来说我们使用actions/checkout@v3,可以填写token,但是新建仓库或者重建仓库时无法提交

我们更改

git remote set-url upstream https://github.com/$owner/$repo.git
git remote set-url origin https://github.com/$username/$repo.git

变为

git remote set-url upstream https://${{token}}:x-oauth-basic@github.com/$owner/$repo.git
git remote set-url origin https://${{token}}:x-oauth-basic@github.com/$username/$repo.git

即可,set-url改为add也适用



posted @ 2022-10-23 22:25  云牧青  阅读(98)  评论(0编辑  收藏  举报