1. 程式人生 > >Git學習之路(四)-通過remote檢視遠端主機資訊

Git學習之路(四)-通過remote檢視遠端主機資訊

有的時候我們需要使用pull命令來從遠端倉庫更新程式碼到本地分支,這個時候我們就要知道遠端主機的名稱是什麼,才能使用pull命令指定遠端主機名稱,我們通常使用remote命令來獲取遠端主機資訊。

語法:git remote show [remote-name]

    $ git remote show
    origin

通過以上命令可以知道有遠端哪些主機。

    $ git remote show origin
    * remote origin
        Fetch URL: https://github.com/AndyWebJava/Activiti.git
        Push  URL: https://github.com/AndyWebJava/Activiti.git
        HEAD branch: develop
        Remote branches:
        2128-salaboy-conformance-tests                        tracked
        activiti-5.11                                         tracked
        activiti-5.11-alf                                     tracked
        activiti-5.13-alf                                     tracked
        activiti-5.19.x                                       tracked
        Local branch configured for 'git pull':
        develop merges with remote develop
        Local ref configured for 'git push':
        develop pushes to develop (up to date)

然後具體指定到那個主機,就可以清楚的這臺主機的詳細資訊了。