Your account has been blocked | permission denied (publickey)

git pull 出现以下提示,优先看下git服务器的状态是不是被 blocked的,需要有master权限:

GitLab: Your account has been blocked.

fatal: Could not read from remote repository.

Your account has been blocked | permission denied (publickey)_第1张图片


恰好一个同事离职后,其git库权限被设置为 blocked,如下图:

Your account has been blocked | permission denied (publickey)_第2张图片

无奈,test机的git库是用他的账户做的公私钥匙。

以下是步骤:

现在在本地重新生成私钥:ssh-keygen -t rsa -b 2048 -C “[email protected]” ,会生成一下文件 id_rsa 和 id_rsa.pub

Your account has been blocked | permission denied (publickey)_第3张图片


再依次试试下面几个命令,每个人遇到的情况不一样,所以下面的命令都试试:

先确认ssh-agent处于启用状态: 

eval “$(ssh-agent -s)”

输出类似于:

Agent pid 32070

然后将SSH key添加到ssh-agent:

ssh-add ~/.ssh/id_rsa

这时又会要你输入密码:

Enter passphrase for /home/xxx/.ssh/id_rsa: 
输入刚才记起来的密码,然后回车

检查 /etc/ssh/sshd_config文件,找到下面的参数

PasswordAuthentication no

将no改成yes,重启SSH服务

sudo /etc/init.d/ssh restart


Your account has been blocked | permission denied (publickey)_第4张图片

都搞完了,如果还有问题就执行下面的命令:

$ git remote set-url origin  ssh://[email protected]:50022/innovation/xxxxx.git




你可能感兴趣的:(Linux,学习)