美文网首页
1.1 Git初始化版本库

1.1 Git初始化版本库

作者: 黄刚刚 | 来源:发表于2019-06-02 17:55 被阅读0次

    续[1.0 Git安装与配置]

    1.在现有目录中初始化仓库

    [root@localhost edu]# git init

    初始化空的 Git 版本库于 /root/git/edu/.git/

    2.查看当前项目配置

    [root@localhost edu]# cat .git/config

    [core]

            repositoryformatversion = 0

            filemode = true

            bare = false

            logallrefupdates = true

    [root@localhost edu]# git config -l 

    user.email=532508307@qq.com 

    user.name=Huang Cui Gang 

    core.repositoryformatversion=0 

    core.filemode=true 

    core.bare=false 

    core.logallrefupdates=true

    3.设置版本库级配置文件

    [root@localhost edu]# git config --local user.name 黄翠刚

    4.再次查看当前项目配置

    [root@localhost edu]# cat .git/config 

    [core] 

             repositoryformatversion = 0 

             filemode = true

             bare = false 

             logallrefupdates = true 

    [user] 

            name = 黄翠刚 

    [root@localhost edu]# git config -l

    user.email=532508307@qq.com

    user.name=Huang Cui Gang

    core.repositoryformatversion=0

    core.filemode=true

    core.bare=false

    core.logallrefupdates=true

    user.name=黄翠刚

    注:从配置信息可以看出来,user.name参数有重复的,后面的参数覆盖前面的参数,所以设置"版本库级配置文件"的参数的优先级要高于"全局级配置文件"就是这个原理,为了证明下面读取一下user.name参数:

    [root@localhost edu]# git config user.name

    黄翠刚

    [root@localhost edu]#

    OK...到这里初始化版本库完成了!

    相关文章

      网友评论

          本文标题:1.1 Git初始化版本库

          本文链接:https://www.haomeiwen.com/subject/zjfhxctx.html