昨天修复好wsl与vscode的连接问题后,wsl上ubuntu18.04的本地代码仓库可以正常使用,但当使用git push推送代码到远程仓库时报错,信息如下:
git push
ssh: Could not resolve hostname codeup.aliyun.com: Temporary failure in name resolution
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
检查远程仓库:
git remote -v
origin git@codeup.aliyun.com:5fbxxx4d95/odoo/abc.git (fetch)
origin git@codeup.aliyun.com:5fbxxx4d95/odoo/abc.git (push)
在远程仓库服务器上将本机公钥重新配置上去,但仍然报错:
git push
The authenticity of host 'codeup.aliyun.com (18.131.65.50)' can't be established.
RSA key fingerprint is SHA256:yEabcVrc3QAvDvoBrTCF2cdefmQ+AbWi9vSt/fE.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'codeup.aliyun.com,18.131.65.50' (RSA) to the list of known hosts.
git@codeup.aliyun.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
看来远程仓库使用SSH方式一时半会搞不好,但可以使用HTTPS。
git删除远程仓库旧的连接地址,再添加新的连接地址,推送远程仓库时输入帐密即可顺利提交代码到远程仓库。
git remote rm origin
git remote add origin https://codeup.aliyun.com/5fbxxx4d95/odoo/abc.git
git push --set-upstream origin master