Olá! No momento, esta página ainda está sendo desenvolvida ou traduzida. Para obter as informações mais recentes, acesse a documentação em inglês.
Versão do artigo: Enterprise Server 2.15

Esta versão do GitHub Enterprise será descontinuada em Esta versão do GitHub Enterprise foi descontinuada em 2019-10-16. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Alterar o remote do URL

O comando 'git remote set-url' altera o URL de um repositório remote existente.

Dica: para obter informações sobre a diferença entre URLs HTTPS e SSH, consulte "Qual URL remote devo usar?"

O comando git remote set-url usa dois argumentos:

Alternar URLs remotes de SSH para HTTPS

  1. Abra Terminal (Terminal)Terminal (Terminal)Git Basho terminal.

  2. Altere o diretório de trabalho atual referente ao seu projeto local.

  3. Liste seus remotes existentes para obter o nome do remote que deseja alterar.

    $ git remote -v
    > origin  git@hostname:USERNAME/REPOSITORY.git (fetch)
    > origin  git@hostname:USERNAME/REPOSITORY.git (push)
  4. Change your remote's URL from SSH to HTTPS with the git remote set-url command.

    $ git remote set-url origin https://hostname/USERNAME/REPOSITORY.git
  5. Verifique se o URL remote foi alterado.

    $ git remote -v
    # Verify new remote URL
    > origin  https://hostname/USERNAME/REPOSITORY.git (fetch)
    > origin  https://hostname/USERNAME/REPOSITORY.git (push)

The next time you git fetch, git pull, or git push to the remote repository, you'll be asked for your GitHub username and password.

Alternar URLs remotes de HTTPS para SSH

  1. Abra Terminal (Terminal)Terminal (Terminal)Git Basho terminal.

  2. Altere o diretório de trabalho atual referente ao seu projeto local.

  3. Liste seus remotes existentes para obter o nome do remote que deseja alterar.

    $ git remote -v
    > origin  https://hostname/USERNAME/REPOSITORY.git (fetch)
    > origin  https://hostname/USERNAME/REPOSITORY.git (push)
  4. Change your remote's URL from HTTPS to SSH with the git remote set-url command.

    $ git remote set-url origin git@hostname:USERNAME/REPOSITORY.git
  5. Verifique se o URL remote foi alterado.

    $ git remote -v
    # Verify new remote URL
    > origin  git@hostname:USERNAME/REPOSITORY.git (fetch)
    > origin  git@hostname:USERNAME/REPOSITORY.git (push)

Solução de Problemas

You may encounter these errors when trying to change a remote.

No such remote '[name]'

This error means that the remote you tried to change doesn't exist:

$ git remote set-url sofake https://hostname/octocat/Spoon-Knife
> fatal: No such remote 'sofake'

Verifique se você inseriu corretamente o nome do remote.

Leia mais

Pergunte a uma pessoa

Não consegue encontrar o que procura?

Entrar em contato