首页 > Web开发 > 详细

已经clone的Git项目从Https切换到SSL

时间:2014-11-20 20:21:35      阅读:321      评论:0      收藏:0      [点我收藏+]

遇到过很多种Git权限的问题,其中有一种就是因为Git采用了二次验证之后需要SSL授权的key才可以有权限pull,push。之前使用SourceTree来Clone项目,但是坑就在这里,一不小心选择了Https的链接,那么拉下来的项目就是HTTPs,再后来切换到二次验证之后就各种权限错误。

那么一不小心范了这样的错误怎么办,删除掉项目重新拉一边?如果已经开发了新的东西就很不方便了,这里给出解决方案:


项目的根目录下面有.git文件,在终端下面进入项目,

然后打开.git下面的config文件:

nano .git/config

就可以看到这个项目的配置,如下面

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = https://github.com/xxx/test.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "develop"]
        remote = origin
        merge = refs/heads/develop
[branch "function_SSO_Login"]
        remote = origin
        merge = refs/heads/function_SSO_Login
[branch "fix_crashlytics_bug"]
        remote = origin
        merge = refs/heads/fix_login_bug
[branch "master"]
在url中将https的链接换成git@github.com:xxx/test.git就可以

一切就恢复了正常.

已经clone的Git项目从Https切换到SSL

原文:http://blog.csdn.net/mobilexu/article/details/41318827

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!