1

I'm new to git and I have a github repository where I want to commit changes to a python file and push . However after accesing my repository from an ubuntu vm now that I am back to windows 10 when I want to push I get

error: failed to push some refs to 'https://github.com/BillSkentos/MovieFlix2020_E17136_SKENTOS_VASILIS.git'

hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.

I'm completely new to git and tried git checkout master and tried pushing but to same result . I would appreciate your help with this . Thank you in advance

7
  • You need to perform git pull as there are changes in the remote that you do not have. It states so in the message : hint: 'git pull ...') before pushing again. Commented Jun 28, 2020 at 9:32
  • @tomerpacific I just typed git pull and got Auto-merging webservice.py CONFLICT (content): Merge conflict in webservice.py Automatic merge failed; fix conflicts and then commit the result. Commented Jun 28, 2020 at 9:33
  • That means that the local changes you have made are causing a code conflict with the changes in the remote repository. Either fix them locally or stash them locally and apply them after pulling. Commented Jun 28, 2020 at 9:36
  • @tomerpacific Could you provide an example ? I'm new to git and find it hard to create the command you say Commented Jun 28, 2020 at 9:39
  • @See here and here. Commented Jun 28, 2020 at 9:46

1 Answer 1

2

In Git 1.7.0 and later, you can checkout a new branch

git checkout -b <branch>

Edit files, add and commit. Then push with the -u (short for --set-upstream) option:

git push -u origin <branch>

Git will set up the tracking information during the push. Now by using these commands , you will not get any error.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.