异常:
Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
解决步骤:
1、首先检查配置是否正确:
第一步,git config --global --list
验证邮箱
第二步,git config --global user.name "yourname",git config --global user.email myemail@qq.com
设置全局用户名和邮箱,
第三步,ssh-keygen -t rsa -C "这里换上你的邮箱"
,生成秘钥,
第四步,到git仓库,添加秘钥,
第五部,ssh -T git@github.com
测试一下通不通,不通就是ssh-agent -s ssh-add ~/.ssh/id_rsa 操作这两步
最后clone,药到病除!!!!
2、如果步骤1配置正确,仍然有异常,尝试执行以下操作
看本地的.git/config设置的仓库url地址和github使用的链接地址是否一致如下图,如use https,则url需要用https的仓库地址,我的就是这个问题。
> cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/mygroup/demo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
可尝试不同类型的github地址。