GITHUB - Problems to associate local repository with remote repository

Asked

Viewed 22 times

0

I’m starting programming and we’re going to use git/github, I’m creating the first project; I followed the steps : I started a repository ( git init ); I linked the local repository to the remote (git remote add origin https://github.com/jlamancio/aula1-github.git; When updating the local repository to remote ( git pull origin master) it is returning the following error: - fatal: couldn’t find remote ref master. Can you help me ?

  • When you create the local repository, the default branch is master; when you create in Github is the branch main (because Github changed this pattern a long time ago). You need to set the same name in the branchs.

1 answer

0

In your local repository the default branch is master. But in Github the default branch is now the main branch. To fix the error you are having you need to rename your local branch from master to main using the command:

git branch -m master main

So when sending to the remote repository you also update the branch you want sent:

 git pull origin main
  • 1

    Thank you very much Leticia, all this for me is new , so I catch quite still !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.