使用github令牌,我发现处理新存储库的最简单方法是。
1. Create the new repo on the github site.
2. git clone https://[user]:ghp_asdcsdcasdcasdcasdcasdcasdc@github.com/[user]/repo-name.git # Using token to authenticate
3. cd into that new folder and then put files in here and then add / commit / push
git add . ; git commit -m "test" ; git status ; git push -u origin master
这是可行的,但不能完全从cli执行过程,需要在站点上执行步骤。
然而,“官方”方式(在github网站上提出)是:
echo "# test-xxx" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/[user]/repo-name.git
git push -u origin master
显然,密码身份验证不再可用,因此自动失败。因此,我将远程添加源更新为git remove add origin https://[user]:ghp_asdcsdcasdcasdcasdcasdcasdc@github.com/[user]/repo-name.git
。
但是这个错误完全失败了:
remote: Repository not found.
fatal: repository 'https://github.com/[user]/repo-name.git/' not found
因此,官方的方式被打破了(因为它假定密码身份验证将起作用,但密码身份验证在2021年8月被删除)。
在cli中,如何在我的帐户下创建一个存储库(使用令牌,而不是密码),然后开始将更改推送到该存储库?
发布于 2021-10-28 05:58:59
这是可行的,但不能完全从cli执行过程,需要在站点上执行步骤。
如果您已在本地安装了gh
,则无需在站点上执行任何步骤
然后你可以:
在讨论中,OP确定如下:
使用
gh
创建回购: gh auth登录
https://stackoverflow.com/questions/69748278
复制相似问题