remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/username/repository.git/'
You are not currently on a branch, so I cannot use any
'branch.<branchname>.merge' in your configuration file.
Please specify which remote branch you want to use on the command
line and try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use
git push origin HEAD:<name-of-remote-branch>
git push 中间遇到的几个问题
SSH钥匙配置受阻
老老实实按教程注册,挡住我最多的其实是找不到GitHub界面上的入口( 在使用
ssh-keygen -t rsa
之后返回还有一个是
./ssh
这个存放钥匙的文件夹好像是隐藏的 所以cd一下定位,然后通过cat
命令读取内容,粘贴回github上的ssh key,其他阻力好像没有什么了,欢迎大家补充git push -u origin master 时需要输入账户与密码
参考的是BSY丶的帖子 返回的时候提示的是
这个问题的原因:github的认证策略发生了改变,在 2021年8月13日 的时候,用户名加密码的认证方式被去掉了,换成了 个人令牌(Personal Access Token)的校验方式。 解决过程中经过了两个步骤
第一步则是靠设置token的方式登录
其中过期时间设置了60天,主要怕我之后忘记怎么做,权限按需选择,也可以全选,生成之后填写命名,这个用来填入下方的
键入
git remote set-url origin https://<token>@github.com/username/repository.git
之后再键入git push origin master
就没问题了,输入password(这里我忘记了是账号密码还是回车,欢迎补充,)第二步个是靠把http的方式改为了ssh的格式
先键入
git remote -v
,返回如下:origin https://github.com/username/repository.git (fetch) origin https://github.com/username/repository.git (push)
键入git remote rm origin
,再次查询就是空的了 输入git remote add origin git@github.com/username/repository.git
,将http更改为ssh的格式, 然后使用git push -u origin master
,就能看到仓库里出现文件了。问题3 You are not currently on a branch
参照的是高低捣蛋鬼的教程
首先是报错信息
(因为我把Debian关了,报错信息没法用一手,就粘贴了大佬的教程),
一手
git branch
,看看自己在哪,返回:执行如下操作:
就是创建分支——切换回master分支——将分支temp合并到master 然后就可以使用
git pull
和git push
了 最后(我是在pull之前),删除temp分支git branch -d temp
搞定 其他的有点忘记了,习惯不是很好,下次我及时写文档里保存、、、