想要在github上传代码,想要用账户和密码上传突然不让上传了,说是必须用token上传,然后就开始把
如果想知道git邮箱账户:
git config --global --list
开始token方式获取权限上传github上
步骤:点击github个人头像旁小箭头,选择Settings
找到图下标红的进行点击
点击Personal access token 就会出现又上角的生成新的token的英文字意,然后点击就会生成
生成以后进行拷贝,最好存储起来,这个token有时间限制,是自己设置的,过期可以重新设置个
将token密码输入就可以上传了
最后就可以了
或者再推到远程地址时可以再路径里添加token
git remote add origin https://{token}@github.com/xxx/xxx.git
这样也可以提交。
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/xxx/xxx.git
git push -u origin main