问题1 No such file or directory
fatal: could not read Username for ‘https://github.com’: No such file or directory
编辑~/.gitconfig并添加以下内容:
[url “[email protected]:”]
insteadOf = https://github.com/
问题2 Permission denied
出现 [email protected]: Permission denied (publickey)错误解决办法
进入git bash界面然后:
第一步,git config –global –list 验证邮箱与GitHub注册时输入的是否一致(不一致的话会导致出现错误,要更改为与GitHub注册是的用户名与账号)
第二步,通过git config –global user.name “yourname”,
git config –global user.email “[email protected] ”
(这里得名字和邮箱都是注册github时用的)设置全局用户名和邮箱。
第三步,ssh-keygen -t rsa -C “github注册时的邮箱”,一路回车,在出现选择时输入Y,再一路回车直到生成密钥。会在/Users/***/路径下生成一个.ssh文件夹,密钥就存储在其中。
第四步,到git仓库,添加秘钥,点击用户名,点击setting,点击左侧SSH and GPG keys
第五步,ssh -T [email protected] 测试一下通不通,显示成功了就ok。
问题3 修改github默认仓库
1
2
3
4
5
6
# 查看远端地址
git remote -v
# 查看远端仓库名
git remote
# 重新设置远程仓库
git remote set-url origin https://gitee.com/xx/xx.git (新地址)
最新地址: https://gitdl.cn/https://github.com//.github.io.git