已經clone的Git項目從Https切換到SSL

來源:互聯網
上載者:User

標籤:style   blog   http   io   ar   color   os   使用   sp   

遇到過很多種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的連結換成[email protected]:xxx/test.git就可以

一切就恢複了正常.

已經clone的Git項目從Https切換到SSL

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.