Skip to main content

Configurar um repositório remoto para um fork

Configure um repositório remoto apontando para o repositório original no Git para sincronizar as alterações entre seu fork e o repositório original.

  1. Abra o terminal ou o Git Bash.

  2. Liste os repositórios remotos atualmente configurados para seu fork.

    $ git remote -v
    > origin  https://github.com/YOUR-USERNAME/YOUR-FORK.git (fetch)
    > origin  https://github.com/YOUR-USERNAME/YOUR-FORK.git (push)
    
  3. Adicione um novo upstream remoto nomeado que aponte para o repositório original.

    git remote add upstream https://github.com/ORIGINAL-OWNER/ORIGINAL-REPOSITORY.git
    
  4. Verifique o novo repositório upstream que você especificou para seu fork.

    $ git remote -v
    > origin    https://github.com/YOUR-USERNAME/YOUR-FORK.git (fetch)
    > origin    https://github.com/YOUR-USERNAME/YOUR-FORK.git (push)
    > upstream  https://github.com/ORIGINAL-OWNER/ORIGINAL-REPOSITORY.git (fetch)
    > upstream  https://github.com/ORIGINAL-OWNER/ORIGINAL-REPOSITORY.git (push)