{"id":1440,"date":"2018-09-01T20:30:00","date_gmt":"2018-09-02T01:30:00","guid":{"rendered":""},"modified":"2018-10-16T09:57:41","modified_gmt":"2018-10-16T14:57:41","slug":"configurar-dos-cuentas-de-gitlab-en-un-mismo-equipo-fedora","status":"publish","type":"post","link":"https:\/\/linuxitos.com\/main\/configurar-dos-cuentas-de-gitlab-en-un-mismo-equipo-fedora\/","title":{"rendered":"Configurar dos cuentas de Gitlab en un mismo equipo: Fedora"},"content":{"rendered":"<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2018\/09\/two_account.png\" style=\"margin-left: 1em; margin-right: 1em;\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" data-original-height=\"571\" data-original-width=\"1124\" height=\"324\" src=\"https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2018\/09\/two_account-300x152.png\" width=\"640\" \/><\/a><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Hace unos d\u00edas en el trabajo estaba actualizando los repositorios de c\u00f3digo en gitlab en mi laptop, y al llegar a casa y revisar mis c\u00f3digos de proyectos personales, intent\u00e9 actualizarlos, pero no funcion\u00f3. Resulta que por la configuraci\u00f3n del correo de gitlab del trabajo, no era posible actualizar los repositorios, por lo tanto me fue necesario configurar ambas cuentas.<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">\u00c9sta configuraci\u00f3n la realic\u00e9 en Fedora 28 x86_64 y utilizando zsh como interprete de comandos linux.<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: x-large;\"><b>Paso 1:<\/b><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Primero se deben generar las dos claves para los correos y obviamente darlas de alta en gitlab.com.<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Para generar las claves, se utilizan el siguiente comando:<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<pre style=\"background: rgb(54, 63, 72); border-radius: 6px; border: 0px; box-sizing: border-box; color: #262626; font-family: &quot;courier 10 pitch&quot;, courier, monospace; font-size: 1.5rem; line-height: 15.68px; margin-bottom: 1.1em; max-width: 100%; outline: 0px; overflow: auto; padding: 13.125px 16.4062px; vertical-align: baseline; word-wrap: break-word;\"><span style=\"border: 0px; color: white; font-family: &quot;menlo&quot; , &quot;monaco&quot; , monospace; font-size: 15px; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;\"> ssh-keygen -t rsa -C \"correo@personal.com\" -b 4096<\/span><\/pre>\n<pre style=\"background: rgb(54, 63, 72); border-radius: 6px; border: 0px; box-sizing: border-box; color: #262626; font-family: &quot;courier 10 pitch&quot;, courier, monospace; font-size: 1.5rem; line-height: 15.68px; margin-bottom: 1.1em; max-width: 100%; outline: 0px; overflow: auto; padding: 13.125px 16.4062px; vertical-align: baseline; word-wrap: break-word;\"><span style=\"border: 0px; color: white; font-family: &quot;menlo&quot; , &quot;monaco&quot; , monospace; font-size: 15px; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;\">ssh-keygen -t rsa -C \"correo@trabajo.com\" -b 4096<\/span><\/pre>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Al generar las claves se crean dos archivos uno con la llave p\u00fablica&nbsp; (.pub)y otro con la llave privadas (rsa)<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Para dar de alta una clave en gitlab, se accede al link&nbsp;<a href=\"https:\/\/gitlab.com\/profile\/keys\">https:\/\/gitlab.com\/profile\/keys<\/a><\/span><\/div>\n<div><\/div>\n<h2><span style=\"text-align: justify;\"><b><span style=\"font-size: x-large;\">Paso 2:<\/span><\/b><\/span><\/h2>\n<div><span style=\"font-size: large; text-align: justify;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Crear un archivo de config dentro la carpeta .ssh que est\u00e1 en la carpeta personal. Con la siguiente configuraci\u00f3n:<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">En el archivo se agregan los dos correos que se utilizar\u00e1n para la conexi\u00f3n.<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<pre style=\"background: url(&quot;about:blank&quot;) 50% 100% repeat-x rgb(245, 245, 245); border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-shadow: rgb(204, 204, 204) 0px 0px 3px; box-sizing: border-box; font-stretch: normal; line-height: 1.6; margin-bottom: 10px; max-width: 100%; outline: 0px; overflow: auto; padding: 9.5px; text-shadow: rgb(255, 255, 255) 0px 1px 0px; vertical-align: baseline; word-break: break-all; word-wrap: break-word;\"><span style=\"color: #274e13; font-family: &quot;menlo&quot; , &quot;monaco&quot; , &quot;consolas&quot; , &quot;courier new&quot; , monospace;\"><span style=\"font-size: 15px; white-space: pre-wrap;\">Host gitlab.com-personal<br \/> HostName gitlab.com<br \/> User git<br \/> IdentityFile ~\/.ssh\/rsa@cuenta.personal<br \/> <br \/>Host gitlab.com-trabajo<br \/>    HostName gitlab.com<br \/>    User git<br \/>    IdentityFile ~\/.ssh\/rsa@cuenta.trabajo<\/span><\/span><\/pre>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Una vez agregado el archivo de configuraci\u00f3n, se procede a realizar un prueba de conexi\u00f3n con el siguiente comando:<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"background-color: white; border: 0px; color: #262626; font-family: &quot;carrois gothic&quot; , sans-serif; font-size: medium; font-style: normal; font-weight: 400; letter-spacing: normal; margin: 0px; outline: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;\"><\/span><\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: rgb(54, 63, 72); border-radius: 6px; border: 0px; box-sizing: border-box; color: #262626; font-family: &quot;courier 10 pitch&quot;, courier, monospace; font-size: 1.5rem; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 15.68px; margin: 0px 0px 1.1em; max-width: 100%; orphans: 2; outline: 0px; overflow: auto; padding: 13.125px 16.4062px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: 2; word-spacing: 0px; word-wrap: break-word;\"><span style=\"border: 0px; color: white; font-family: &quot;menlo&quot; , &quot;monaco&quot; , monospace; font-size: 15px; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;\">ssh -T git@gitlab.com-personal<\/span><\/pre>\n<pre style=\"background: rgb(54, 63, 72); border-radius: 6px; border: 0px; box-sizing: border-box; color: #262626; font-family: &quot;courier 10 pitch&quot;, courier, monospace; font-size: 1.5rem; line-height: 15.68px; margin-bottom: 1.1em; max-width: 100%; outline: 0px; overflow: auto; padding: 13.125px 16.4062px; vertical-align: baseline; word-wrap: break-word;\"><span style=\"border: 0px; color: white; font-family: &quot;menlo&quot; , &quot;monaco&quot; , monospace; font-size: 15px; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;\">ssh -T git@gitlab.com-trabajo<\/span><\/pre>\n<div><span style=\"border: 0px; color: white; font-family: &quot;menlo&quot; , &quot;monaco&quot; , monospace; font-size: 15px; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">El mensaje que debe mostrar en caso de ser correcto, es el siguiente por cada cuenta configurada:<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<pre style=\"background: url(&quot;about:blank&quot;) 50% 100% repeat-x rgb(245, 245, 245); border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-shadow: rgb(204, 204, 204) 0px 0px 3px; box-sizing: border-box; font-stretch: normal; line-height: 1.6; margin-bottom: 10px; max-width: 100%; outline: 0px; overflow: auto; padding: 9.5px; text-shadow: rgb(255, 255, 255) 0px 1px 0px; vertical-align: baseline; word-break: break-all; word-wrap: break-word;\"><span style=\"color: #274e13; font-family: &quot;menlo&quot; , &quot;monaco&quot; , &quot;consolas&quot; , &quot;courier new&quot; , monospace;\"><span style=\"font-size: 15px; white-space: pre-wrap;\">Welcome to GitLab, @Nombre-del-usuario-de-gitlab!<\/span><\/span><\/pre>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><b><span style=\"font-size: x-large;\">Paso 3:<\/span><\/b><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Configurar cada repositorio para cada cuenta, los proyectos se pueden clonar de manera normal, pero para realizar una actualizaci\u00f3n, es necesario ir al proyecto, y buscar la carpeta <b>.git<\/b> y editar el archivo <b>config<\/b> de la siguiente manera:<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Por ejemplo, el siguiente c\u00f3digo es configuraci\u00f3n para que se conecte con la cuenta de trabajo:<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<pre style=\"background: url(&quot;about:blank&quot;) 50% 100% repeat-x rgb(245, 245, 245); border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-shadow: rgb(204, 204, 204) 0px 0px 3px; box-sizing: border-box; font-stretch: normal; line-height: 1.6; margin-bottom: 10px; max-width: 100%; outline: 0px; overflow: auto; padding: 9.5px; text-shadow: rgb(255, 255, 255) 0px 1px 0px; vertical-align: baseline; word-break: break-all; word-wrap: break-word;\"><span style=\"color: #274e13; font-family: &quot;menlo&quot; , &quot;monaco&quot; , &quot;consolas&quot; , &quot;courier new&quot; , monospace;\"><span style=\"font-size: 15px; white-space: pre-wrap;\">[core]<br \/> repositoryformatversion = 0<br \/> filemode = true<br \/> bare = false<br \/> logallrefupdates = true<br \/>[remote \"origin\"]<br \/> url = git@gitlab.com-trabajo:nom_repo\/nom_deb_v3.0.git<br \/> fetch = +refs\/heads\/*:refs\/remotes\/origin\/*<br \/>[branch \"master\"]<br \/> remote = origin<br \/> merge = refs\/heads\/master<br \/>[user]<br \/> name = Nombre de Usuario<br \/> email = cuenta@trabajo.com<\/span><\/span><\/pre>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Por ejemplo, el siguiente c\u00f3digo es configuraci\u00f3n para que se conecte con la cuenta de personal:<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<pre style=\"background: url(&quot;about:blank&quot;) 50% 100% repeat-x rgb(245, 245, 245); border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-shadow: rgb(204, 204, 204) 0px 0px 3px; box-sizing: border-box; font-stretch: normal; line-height: 1.6; margin-bottom: 10px; max-width: 100%; outline: 0px; overflow: auto; padding: 9.5px; text-shadow: rgb(255, 255, 255) 0px 1px 0px; vertical-align: baseline; word-break: break-all; word-wrap: break-word;\"><span style=\"color: #274e13; font-family: &quot;menlo&quot; , &quot;monaco&quot; , &quot;consolas&quot; , &quot;courier new&quot; , monospace;\"><span style=\"font-size: 15px; white-space: pre-wrap;\">[core]<br \/> repositoryformatversion = 0<br \/> filemode = true<br \/> bare = false<br \/> logallrefupdates = true<br \/>[remote \"origin\"]<br \/> url = git@gitlab.com-personal:nom_repo\/nom_deb_v3.0.git<br \/> fetch = +refs\/heads\/*:refs\/remotes\/origin\/*<br \/>[branch \"master\"]<br \/> remote = origin<br \/> merge = refs\/heads\/master<br \/>[user]<br \/> name = Nombre de Usuario<br \/> email = cuenta@personal.com<\/span><\/span><\/pre>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Y con eso, se pueden hacer las actualizaciones de manera independiente de cada repositorio.<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Si por ejemplo, se quiere clonar un proyecto con una cuenta en espec\u00edfica, se puede utilizar de la siguiente manera:<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<pre style=\"background: rgb(54, 63, 72); border-radius: 6px; border: 0px; box-sizing: border-box; color: #262626; font-family: &quot;courier 10 pitch&quot;, courier, monospace; font-size: 1.5rem; line-height: 15.68px; margin-bottom: 1.1em; max-width: 100%; outline: 0px; overflow: auto; padding: 13.125px 16.4062px; vertical-align: baseline; word-wrap: break-word;\"><span style=\"border: 0px; color: white; font-family: &quot;menlo&quot; , &quot;monaco&quot; , monospace; font-size: 15px; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;\">git@gitlab.com-personal:username1\/test-project.git<\/span><\/pre>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Fuentes:<\/span><\/div>\n<div style=\"text-align: justify;\"><a href=\"https:\/\/stackoverflow.com\/questions\/30320458\/how-to-set-up-two-ssh-keys-for-two-gitlab-accounts-and-push-pull-by-using-tortoi\">https:\/\/stackoverflow.com\/questions\/30320458\/how-to-set-up-two-ssh-keys-for-two-gitlab-accounts-and-push-pull-by-using-tortoi<\/a><\/div>\n<div style=\"text-align: justify;\"><a href=\"https:\/\/coderwall.com\/p\/7smjkq\/multiple-ssh-keys-for-different-accounts-on-github-or-gitlab\">https:\/\/coderwall.com\/p\/7smjkq\/multiple-ssh-keys-for-different-accounts-on-github-or-gitlab<\/a><\/div>\n<div style=\"text-align: justify;\"><a href=\"https:\/\/stackoverflow.com\/questions\/37895592\/how-to-use-multiple-ssh-keys-for-multiple-gitlab-accounts-with-the-same-host#37901351\">https:\/\/stackoverflow.com\/questions\/37895592\/how-to-use-multiple-ssh-keys-for-multiple-gitlab-accounts-with-the-same-host#37901351<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hace unos d\u00edas en el trabajo estaba actualizando los repositorios de c\u00f3digo en gitlab en mi laptop, y al llegar a casa y revisar mis c\u00f3digos de proyectos personales, intent\u00e9 actualizarlos, pero no funcion\u00f3. Resulta que por la configuraci\u00f3n del correo de gitlab del trabajo, no era posible actualizar los repositorios, por lo tanto me [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":754,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,16,15,17],"tags":[],"class_list":["post-1440","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fedora","category-gitlab","category-two-account-gitlab","category-two-account-use-in-fedora"],"_links":{"self":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/1440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/comments?post=1440"}],"version-history":[{"count":1,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/1440\/revisions"}],"predecessor-version":[{"id":1879,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/1440\/revisions\/1879"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/media\/754"}],"wp:attachment":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/media?parent=1440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/categories?post=1440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/tags?post=1440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}