⇤ ← Versión 1 con fecha 2019-08-09 14:16:24
Tamaño: 5519
Comentario:
|
← Versión 2 con fecha 2019-08-09 14:38:50 ⇥
Tamaño: 5080
Comentario:
|
Los textos eliminados se marcan así. | Los textos añadidos se marcan así. |
Línea 14: | Línea 14: |
||<class="gutter">1||<class="code">/etc/gitconfig|| |
{{{ /etc/gitconfig }}} |
Línea 18: | Línea 19: |
||<class="gutter">1||<class="code">%INSTALACION_GIT%/etc/gitconfig|| |
{{{ %INSTALACION_GIT%/etc/gitconfig }}} |
Línea 23: | Línea 26: |
||<class="gutter">123456789101112131415||<class="code">$ git config --list --systemcore.symlinks=falsecore.autocrlf=truecolor.diff=autocolor.status=autocolor.branch=autocolor.interactive=truepack.packsizelimit=2ghelp.format=htmlhttp.sslcainfo=/bin/curl-ca-bundle.crtsendemail.smtpserver=/bin/msmtp.exediff.astextplain.textconv=astextplainrebase.autosquash=trueuser.name=user name systemuser.email=system@domain|| |
{{{ $ git config --list --system core.symlinks=false core.autocrlf=true color.diff=auto color.status=auto color.branch=auto color.interactive=true pack.packsizelimit=2g help.format=html http.sslcainfo=/bin/curl-ca-bundle.crt sendemail.smtpserver=/bin/msmtp.exe diff.astextplain.textconv=astextplain rebase.autosquash=true user.name=user name system user.email=system@domain }}} |
Línea 28: | Línea 46: |
||<class="gutter">12||<class="code">$ git config --system --get user.nameuser name system|| |
{{{ $ git config --system --get user.name user name system }}} |
Línea 33: | Línea 54: |
||<class="gutter">123||<class="code">$ git config --system user.name myuser$ git config --system --get user.namemyuser|| |
{{{ $ git config --system user.name myuser $ git config --system --get user.name myuser }}} |
Línea 38: | Línea 62: |
||<class="gutter">123456||<class="code">$ git config --system --add key.one value1$ git config --system --get key.onevalue1$ git config --system --unset key.one$ git config --system --get key.one.|| |
{{{ $ git config --system --add key.one value1 $ git config --system --get key.one value1 $ git config --system --unset key.one $ git config --system --get key.one . }}} |
Línea 44: | Línea 76: |
||<class="gutter">1||<class="code">$USER_HOME/.gitconfig|| |
{{{ $USER_HOME/.gitconfig }}} |
Línea 49: | Línea 83: |
||<class="gutter">1234||<class="code">$ git config --list --globaluser.name=user name globaluser.email=global@domaincore.autocrlf=true|| |
{{{ $ git config --list --global user.name=user name global user.email=global@domain core.autocrlf=true }}} |
Línea 54: | Línea 93: |
||<class="gutter">12||<class="code">$ git config --global --get user.nameuser name global|| |
{{{ $ git config --global --get user.name user name global }}} |
Línea 59: | Línea 102: |
||<class="gutter">123||<class="code">$ git config --global user.name myuser_global$ git config --global --get user.namemyuser_global|| |
{{{ $ git config --global user.name myuser_global $ git config --global --get user.name myuser_global }}} |
Línea 64: | Línea 111: |
||<class="gutter">123456||<class="code">$ git config --global --add key.one value1$ git config --global --get key.onevalue1$ git config --global --unset key.one$ git config --global --get key.one.|| |
{{{ $ git config --global --add key.one value1 $ git config --global --get key.one value1 $ git config --global --unset key.one $ git config --global --get key.one . }}} |
Línea 70: | Línea 124: |
||<class="gutter">1||<class="code">$XDG_CONFIG_HOME/git/config|| |
{{{ $XDG_CONFIG_HOME/git/config }}} |
Línea 75: | Línea 131: |
||<class="gutter">1||<class="code">$USER_HOME/.config/git/config || |
{{{ $USER_HOME/.config/git/config }}} |
Línea 85: | Línea 142: |
||<class="gutter">1||<class="code">$DIR_CURRENT_REPOSITORY/.git/config|| |
{{{ $DIR_CURRENT_REPOSITORY/.git/config }}} |
Línea 90: | Línea 149: |
||<class="gutter">12345678910111213||<class="code">$ cd /temporal$ mkdir my_repo$ cd my_repo$ git initInitialized empty Git repository in /TEMPORAL/my_repo/.git/ $ git add .$ git commit -m "version inicial"On branch master Initial commit nothing to commit|| |
{{{ $ cd /temporal $ mkdir my_repo $ cd my_repo $ git init Initialized empty Git repository in /TEMPORAL/my_repo/.git/ $ git add . $ git commit -m "version inicial" On branch master Initial commit nothing to commit }}} |
Línea 95: | Línea 168: |
||<class="gutter">12345678||<class="code">$ git config --list --localcore.repositoryformatversion=0core.filemode=falsecore.bare=falsecore.logallrefupdates=truecore.symlinks=falsecore.ignorecase=truecore.hidedotfiles=dotGitOnly|| |
{{{ $ git config --list --local core.repositoryformatversion=0 core.filemode=false core.bare=false core.logallrefupdates=true core.symlinks=false core.ignorecase=true core.hidedotfiles=dotGitOnly }}} |
Línea 100: | Línea 182: |
||<class="gutter">1234567||<class="code">$ git config --local --add key.one value1$ git config --local --get key.onevalue1$ git config --local key.one value2$ git config --local --unset key.one$ git config --local --get key.one.|| |
{{{ $ git config --local --add key.one value1 $ git config --local --get key.one value1 $ git config --local key.one value2 $ git config --local --unset key.one $ git config --local --get key.one . }}} |
Línea 105: | Línea 195: |
||<class="gutter">123456||<class="code">$ git config --local user.name myuser_local$ git config --local user.email myuser_local@localdomain$ git config --local --get user.namemyuser_local$ git config --local --get user.emailmyuser_local@localdomain|| |
{{{ $ git config --local user.name myuser_local $ git config --local user.email myuser_local@localdomain $ git config --local --get user.name myuser_local $ git config --local --get user.email myuser_local@localdomain }}} |
Una vez hemos instalado Git su configuración es bastante sencilla al estar basada en la modificación de un fichero de variables. Dependiendo del tipo de configuración que necesitemos, la modificación de este fichero se hace en un sitio diferente.
Estas variables definen el comportamiento que tendrá Git cuando ejecute sus comandos. Por ejemplo, alguna de ellas sirve para indicar el editor que debe utilizar para añadir el mensaje cuando hacemos un commit o creamos un tag, otras indican el usuario a utilizar cuando hacemos un commit, etc.
Todas esta variables se pueden crear, modificar y borrar. En este pequeño artículo vamos a ver como hacerlo y cuales son los ficheros afectados en estas operaciones.
Recordemos que al tener diferentes niveles de configuración, si tenemos una propiedad igual a nivel de un repositorio local, tendrá más preferencia sobre el valor de la misma variable a nivel de global o del sistema.
Configuración a nivel del sistema
Afecta a la configuración de Git de todo el sistema. En este caso a cualquier repositorio y usuario del sistema. El fichero modificado en este caso es
En sistemas Unix
/etc/gitconfig
En windows
%INSTALACION_GIT%/etc/gitconfig
Ejemplo listado de las variables
$ git config --list --system core.symlinks=false core.autocrlf=true color.diff=auto color.status=auto color.branch=auto color.interactive=true pack.packsizelimit=2g help.format=html http.sslcainfo=/bin/curl-ca-bundle.crt sendemail.smtpserver=/bin/msmtp.exe diff.astextplain.textconv=astextplain rebase.autosquash=true user.name=user name system user.email=system@domain
Obtener el valor de una de las variables
$ git config --system --get user.name user name system
Modificación de una de las variables
$ git config --system user.name myuser $ git config --system --get user.name myuser
Creación y borrado de una nueva variable
$ git config --system --add key.one value1 $ git config --system --get key.one value1 $ git config --system --unset key.one $ git config --system --get key.one .
Configuración a nivel de usuario llamado también configuración a nivel global
Afecta a la configuración de Git de un usuario. En este caso solo a sus repositorios. El fichero modificado en este caso es
$USER_HOME/.gitconfig
Listado de las variables
$ git config --list --global user.name=user name global user.email=global@domain core.autocrlf=true
Obtener el valor de una de las variables
$ git config --global --get user.name user name global
Modificación de una de las variables
$ git config --global user.name myuser_global $ git config --global --get user.name myuser_global
Creación y borrado de una nueva variable
$ git config --global --add key.one value1 $ git config --global --get key.one value1 $ git config --global --unset key.one $ git config --global --get key.one .
Segunda configuración a nivel de usuario
Tiene preferencia la configuración a nivel de usuario vista anteriormente sobre esta configuración. El fichero afectado en este caso si existe es
$XDG_CONFIG_HOME/git/config
Y el caso de que el anterior fichero no exista, el fichero sería:
$USER_HOME/.config/git/config
Recordemos que XDG_CONFIG_HOME es una variable que estaría apuntando a un directorio de configuración según la especificación XDG Base Directory Specification
Aunque se recomienda no utilizar este fichero de configuración.
Configuración a nivel de repositorio o configuración local
Solo afecta a la configuración del repositorio donde lo modificamos. El fichero afectado en este caso es
$DIR_CURRENT_REPOSITORY/.git/config
Creamos un nuevo repositorio
$ cd /temporal $ mkdir my_repo $ cd my_repo $ git init Initialized empty Git repository in /TEMPORAL/my_repo/.git/ $ git add . $ git commit -m "version inicial" On branch master Initial commit nothing to commit
Listado de las variables
$ git config --list --local core.repositoryformatversion=0 core.filemode=false core.bare=false core.logallrefupdates=true core.symlinks=false core.ignorecase=true core.hidedotfiles=dotGitOnly
Creación, obtención, modificación y borrado de una nueva variable
$ git config --local --add key.one value1 $ git config --local --get key.one value1 $ git config --local key.one value2 $ git config --local --unset key.one $ git config --local --get key.one .
Configuración del usuario y email asociado a este repositorio
$ git config --local user.name myuser_local $ git config --local user.email myuser_local@localdomain $ git config --local --get user.name myuser_local $ git config --local --get user.email myuser_local@localdomain