1
0
mirror of synced 2026-01-20 12:02:14 -05:00
Files
docs/translations/es-ES/content/github/using-git/changing-a-remotes-url.md
Vanessa Yuen 5336b9a35c translations batch (#17637)
* New Crowdin translations by Github Action

* fix frontmatter errors in translation

* fix release notes

* revert broken translation to main

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2021-02-02 19:56:26 +00:00

4.0 KiB

title, redirect_from, intro, versions
title redirect_from intro versions
Cambiar la URL de un remoto
/articles/changing-a-remote-s-url
/articles/changing-a-remotes-url
El comando `git remote set-url` cambia una URL del repositorio remoto existente.
free-pro-team enterprise-server github-ae
* * *

{% tip %}

Sugerencia: Para obtener información sobre la diferencia entre las URL HTTPS y SSH consulta "¿Qué URL remota debería usar?"

{% endtip %}

El comando git remote set-url toma dos argumentos:

  • Un nombre de remoto existente. Por ejemplo, origin o upstream son dos de las opciones comunes.
  • Una nueva URL para el remoto. Por ejemplo:
    • Si estás actualizando para usar HTTPS, tu URL puede verse como:
https://{% data variables.command_line.backticks %}/<em>USERNAME</em>/<em>REPOSITORY</em>.git
  • Si estás actualizando para usar SSH, tu URL puede verse como:
git@{% data variables.command_line.codeblock %}:<em>USERNAME</em>/<em>REPOSITORY</em>.git

Cambiar direcciones URL remotas de SSH a HTTPS

{% data reusables.command_line.open_the_multi_os_terminal %} 2. Cambiar el directorio de trabajo actual en tu proyecto local. 3. Enumerar tus remotos existentes a fin de obtener el nombre de los remotos que deseas cambiar.

$ git remote -v
> origin  git@{% data variables.command_line.codeblock %}:<em>USERNAME/REPOSITORY</em>.git (fetch)
> origin  git@{% data variables.command_line.codeblock %}:<em>USERNAME/REPOSITORY</em>.git (push)
  1. Cambiar tu URL remota de SSH a HTTPS con el comando git remote set-url.
$ git remote set-url origin https://{% data variables.command_line.codeblock %}/<em>USERNAME</em>/<em>REPOSITORY</em>.git
  1. Verificar que la URL remota ha cambiado.
$ git remote -v
# Verify new remote URL
> origin  https://{% data variables.command_line.codeblock %}/<em>USERNAME/REPOSITORY</em>.git (fetch)
> origin  https://{% data variables.command_line.codeblock %}/<em>USERNAME/REPOSITORY</em>.git (push)

La próxima vez que ejecutes git, git pull o git push en el repositorio remoto, se te pedirá el nombre de usuario y la contraseña de GitHub. {% data reusables.user_settings.password-authentication-deprecation %}

Puedes utilizar un ayudante de credenciales para que Git recuerde tu nombre de usuario y token de acceso personal cada vez que se comunique con GitHub.

Cambiar las URL remotas de HTTPS a SSH

{% data reusables.command_line.open_the_multi_os_terminal %} 2. Cambiar el directorio de trabajo actual en tu proyecto local. 3. Enumerar tus remotos existentes a fin de obtener el nombre de los remotos que deseas cambiar.

$ git remote -v
> origin  https://{% data variables.command_line.codeblock %}/<em>USERNAME/REPOSITORY</em>.git (fetch)
> origin  https://{% data variables.command_line.codeblock %}/<em>USERNAME/REPOSITORY</em>.git (push)
  1. Cambiar tu URL remota de HTTPS a SSH con el comando git remote set-url.
$ git remote set-url origin git@{% data variables.command_line.codeblock %}:<em>USERNAME</em>/<em>REPOSITORY</em>.git
  1. Verificar que la URL remota ha cambiado.
$ git remote -v
# Verify new remote URL
> origin  git@{% data variables.command_line.codeblock %}:<em>USERNAME/REPOSITORY</em>.git (fetch)
> origin  git@{% data variables.command_line.codeblock %}:<em>USERNAME/REPOSITORY</em>.git (push)

Solución de problemas

Puedes encontrar estos errores cuando intentes cambiar un remoto.

No existe tal remoto '[name]'

Este error significa que el remoto que trataste de cambiar no existe:

$ git remote set-url sofake https://{% data variables.command_line.codeblock %}/octocat/Spoon-Knife
> fatal: No such remote 'sofake'

Comprueba que escribiste correctamente el nombre del remoto.

Leer más