git:无法推送GitLab
我在GitLab上创建了一个存储库,并且有一个本地项目 发件人:git:无法推送GitLab,git,gitlab,Git,Gitlab,我在GitLab上创建了一个存储库,并且有一个本地项目 发件人:git-remote-vI获取: origin git@gitlab.com:projects/MyPrj.git (fetch) origin git@gitlab.com:projects/MyPrj.git (push) 当我尝试使用以下命令将其推送到存储库时: git push origin master 我得到这个错误: Permission denied (publickey). fatal: Could not
git-remote-v
I获取:
origin git@gitlab.com:projects/MyPrj.git (fetch)
origin git@gitlab.com:projects/MyPrj.git (push)
当我尝试使用以下命令将其推送到存储库时:
git push origin master
我得到这个错误:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我可以使用web浏览器访问存储库,但不能从命令行的git访问
我做错了什么?检查与本地克隆回购相关联的远程URL:
cd /path/to/your/repo
git remote -v
根据其方案(https或ssh),您需要确保正确设置了身份验证
- https:您需要输入一次凭据,以便将它们缓存在git credential helper中(检查
返回的内容)git config credential.helper
- ssh:确保您有一个
文件(公钥和私钥rsa ssh密钥,公钥内容在远程托管服务上注册)/path/to/home/.ssh/id\u rsa(.pub)
ssh-keygen -P "" -s -t rsa
然后复制GitLab上的
~/.ssh/id\u rsa.pub
内容。检查与本地克隆repo关联的远程URL:
cd /path/to/your/repo
git remote -v
根据其方案(https或ssh),您需要确保正确设置了身份验证
- https:您需要输入一次凭据,以便将它们缓存在git credential helper中(检查
返回的内容)git config credential.helper
- ssh:确保您有一个
文件(公钥和私钥rsa ssh密钥,公钥内容在远程托管服务上注册)/path/to/home/.ssh/id\u rsa(.pub)
ssh-keygen -P "" -s -t rsa
然后将
~/.ssh/id_rsa.pub
内容复制到GitLab上。如果您使用ssh身份验证,可能值得尝试HTTPS,以检查这是否是问题所在。(我绝不是Git高手,因此除了传递它之外,我无法提供任何内容).For me的可能副本有助于从git@gitlab.com:…
至https://gitlab.com/...
如果您使用的是SSH身份验证,那么可能值得尝试HTTPS,以检查这是否是问题所在。(我绝对不是Git高手,因此除了传递它之外,我无法提供任何内容).For me的可能副本有助于从git@gitlab.com:…
至https://gitlab.com/...