天天看點

push failed:Unable to access ‘https://gitee(github).com/倉庫名‘

在換了網絡後可能會出現上面這種情況,通過修改hosts檔案可以解決

  • 先确認下網絡情況

    浏覽器打開倉庫或其他網頁試試,可以打開的話就說明網絡沒問題。那如果打不開呢?親,這邊建議您切換下網絡試試

    排除網絡原因後

  • 獲得電腦的ip位址

    打開指令行,輸入–>ipconfig

    push failed:Unable to access ‘https://gitee(github).com/倉庫名‘

複制IPv4位址

  • 修改hosts檔案

    找到git的安裝目錄/etc/hosts

    push failed:Unable to access ‘https://gitee(github).com/倉庫名‘

    右鍵點選用記事本或Notepad等軟體打開

    如果是連接配接gitee失敗就在最一行加上(中間有空格)

    ip位址 gitee.com

    如果是連接配接github失敗就在最一行加上(中間有空格)

    ip位址 github.com

    如下圖所示:

    push failed:Unable to access ‘https://gitee(github).com/倉庫名‘
    完成後再重新commit、push試試吧