Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use git config for related configuration operations in gitlab

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use git config for related configuration operations in gitlab, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.

Command: git config

Use git config for configuration operations

profile

git as a whole, configuration files are divided into three levels, combined with priority related information as follows

Simply put, the closer you are to the repository, the higher the priority, so project level> user level> system level. When the same settings appear at the same time, the higher priority overrides the configuration above.

configuration check

Use git config different parameters to check the settings of the above three different levels

Because the same settings may cause overrides, using git config -l lists what git considers the final settings.

problem phenomenon

Many clients encounter problems when automatically generating.gitignore, such as the following version of git and os encountered ng new action error prompt

environmental information

liumiaocn:angualr liumiao$ git --versiongit version 2.15.0liumiaocn:angualr liumiao$ uname -aDarwin liumiaocn 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64liumiaocn:angualr liumiao$ liumiaocn:angualr liumiao$ ng --version _ _ ____ _ ___ / \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _| / △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | | / ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___| |___/Angular CLI: 1.7.3Node: 8.9.1OS: darwin x64Angular: ... liumiaocn:angualr liumiao$

phenomenon

liumiaocn:angualr liumiao$ ng new demo1 --skip-install create demo1/README.md (1021 bytes) create demo1/.angular-cli.json (1240 bytes)... Omit create demo1/src/app/app. component.ts (207 bytes)error: could not expand include path '~/.gitcinclude'fatal: bad config line 44 in file /usr/local/git/etc/gitconfigProject 'demo1' successfully created.liumiaocn:angualr liumiao$

configuration information

liumiaocn:angualr liumiao$ cat /usr/local/git/etc/gitconfig [core] excludesfile = ~/.gitignore legacyheaders = false # >git 1.5 quotepath = false[user]# name = your name# email = your@name[mergetool] keepBackup = true[push] default = simple # [ matching | simple ][color] ui = auto interactive = auto[repack] usedeltabaseoffset = true # >git 1.5[alias] s = status a = ! git add . && git status au = ! git add -u . && git status aa = ! git add . && git add -u . && git status c = commit cm = commit -m ca = commit --amend # careful ac = ! git add . && git commit acm = ! git add . && git commit -m l = log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset' ll = log --stat --abbrev-commit lg = log --color --graph --pretty=format:'%C(bold white)%h%Creset -%C(bold green)%d%Creset %s %C(bold green)(%cr)%Creset %C(bold blue)%Creset' --abbrev-commit --date=relative llg = log --color --graph --pretty=format:'%C(bold white)%H %d%Creset%n%s%n%+b%C(bold blue)%an %Creset %C(bold green)%cr (%ci)' --abbrev-commit d = diff master = checkout master spull = svn rebase spush = svn dcommit alias = ! git config --list | grep 'alias\\. ' | sed 's/alias\\.\\ ([^=]*\\)=\\(.*\\)/\\ 1\\\t => \\2/' | sort[include] # as of 1.7.10 https://github.com/git/git/commit/9b25a0b52e09400719366f0a33d0d0da98bbf7b0 path = ~/.gitcinclude path = .githubconfig path = .gitcredential#[github]# user =# token =[diff] # git does copy/rename *detection*. if you want it to track copies/renames: # http://stackoverflow.com/questions/1043388/record-file-copy-operation-with-git # renames = copies[diff "exif"] textconv = exif[credential] helper = osxkeychainliumiaocn:angualr liumiao$

reason

The reason seems to be that there is a problem with the expansion of ~. Expanding ~ to a global name in the settings file temporarily solves this problem, but it can be seen from the above that it is actually a way to reduce the system-level settings to the user-level.

modification method

liumiaocn:angualr liumiao$ sudo cp /usr/local/git/etc/gitconfig /usr/local/git/etc/gitconfig.orgPassword:liumiaocn:angualr liumiao$ echo $HOME/Users/liumiaoliumiaocn:angualr liumiao$ echo ~/Users/liumiaoliumiaocn:angualr liumiao$ sudo vi /usr/local/git/etc/gitconfigliumiaocn:angualr liumiao$ liumiaocn:angualr liumiao$ diff /usr/local/git/etc/gitconfig /usr/local/git/etc/gitconfig.org2c2

< excludesfile = /Users/liumiao/.gitignore--->

excludesfile = ~/.gitignore44c44

< path = /Users/liumiao/.gitcinclude--->

path = ~/.gitcincludeliumiaocn:angualr liumiao$Thank you for reading this article carefully. I hope that Xiaobian's "How to use git config for related configuration operations in gitlab" article will be helpful to everyone. At the same time, I hope that everyone will support it a lot. Pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report