![rejected]master->master (non-fast-forward)![remote rejected] (deny updating a hidden ref)push报错解决

问题:在开发中首次push代码到远程分支失败,不能关联远程分支也不能push到远端指定分支

 ![rejected]master->master (non-fast-forward)![remote rejected] (deny updating a hidden ref)push报错解决_第1张图片

 解决:配置git仓库 SSH

步骤:

1.打开git bash 配置用户名
git config --global user.name “xxx”
2. 配置自己的用户邮箱
git config --global user.email “[email protected]
3. 生成密钥(执行该语句后 需回车几次完成)
ssh-keygen -t rsa -C “[email protected]
4.配置 ssh 变量
git config --global ssh.variant ssh

5. 打开生成公钥的文件夹C:\Users\Administrator\.ssh下面的文件 id_rsa.pub 复制里面内容

![rejected]master->master (non-fast-forward)![remote rejected] (deny updating a hidden ref)push报错解决_第2张图片6. 登录GitLab将上面复制的内容粘贴到 SSH Key

![rejected]master->master (non-fast-forward)![remote rejected] (deny updating a hidden ref)push报错解决_第3张图片 

 

你可能感兴趣的:(git,git)