cat .git/config查看远端服务器信息(git的配置信息:远端服务器连接信息)

本地git库中,查找其连接的远端服务器信息:

   每个git库都会有一个配置信息文件.git/config。

   cat .git/config,可以看到信息如下:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = git@repo.XXX.com:aaa
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[branch "waterforest"]
        remote = origin
        merge = refs/heads/waterforest
~

可以看到连接远端服务器的信息。

git安装后,就可以clone远端分支到本地。从远端拉倒本地后,本地git库默认构建.git文件目录。保存基本信息,如连接信息。全的git在那

.git/目录下有很多文件,都是git库相关的信息:

 branches
 config
description
FETCH_HEAD
HEAD
 hooks
index
info
 logs
 objects
 ORIG_HEAD
 packed-refs
 refs

存放着各种信息。

如果只在本地创建仓库,那么.git/config文件只有这么几行:

  1. <SPANstyle="FONT-SIZE: 16px">[core]
  2. repositoryformatversion = 0
  3. filemode = true
  4. bare = false
  5. logalrefupdates =true</SPAN>.

 

如果这个仓库通过git remote add origin git@git_i5:nexus/android_4_0.git 添加到远程服务器git_i5的仓库,那么这个文件会多出下面几行:

  1. <SPANstyle="FONT-SIZE: 16px">[remote "origin"]
  2. fetch = +refs/heads/*:refs/remotes/origin/*
  3. url = git@git_i5:nexus/android_4_0.git</SPAN>

 

原文地址:https://www.cnblogs.com/cl1024cl/p/6205479.html