-2

I am trying to push my code to GitHub and it is giving me errors.

I have tried

git add .
git commit -m "blah"
git push origin master
git push --force

all with no success.

Georges-MacBook-Pro-2:meetlete georgeconnolly$ git push --set-upstream origin main
To https://github.com/grobconnolly/meetlete.git
 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/grobconnolly/meetlete.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.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

enter image description here

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Rob Connolly
  • 1
  • 1
  • 1
  • 1
    Did you read and understand the green text prefixed with "hint"? – mkrieger1 Jan 10 '21 at 16:01
  • yes, but i dont know how to fix it, – Rob Connolly Jan 10 '21 at 16:05
  • Can you first run `git fetch` and then show a screenshot of `gitk --all` (or equivalent representation of the relevant parts of the commit graph)? – mkrieger1 Jan 10 '21 at 16:06
  • Georges-MacBook-Pro-2:meetlete georgeconnolly$ git fetch Georges-MacBook-Pro-2:meetlete georgeconnolly$ git -all unknown option: -all usage: git [--version] [--help] [-C ] [-c =] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare] [--git-dir=] [--work-tree=] [--namespace=] [] Georges-MacBook-Pro-2:meetlete georgeconnolly$ – Rob Connolly Jan 10 '21 at 16:08
  • Not `git -all`, but `gitk --all`. – mkrieger1 Jan 10 '21 at 16:08
  • Georges-MacBook-Pro-2:meetlete georgeconnolly$ gitk --all -bash: gitk: command not found Georges-MacBook-Pro-2:meetlete georgeconnolly$ – Rob Connolly Jan 10 '21 at 16:11

1 Answers1

1

Try to do a git pull, seem like your branch is not updated

Dannick Bedard
  • 373
  • 3
  • 14
  • There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/ main Georges-MacBook-Pro-2:meetlete georgeconnolly$ – Rob Connolly Jan 10 '21 at 16:02
  • Try : git pull origin master – Dannick Bedard Jan 10 '21 at 16:06
  • or : or git branch --set-upstream-to=origin/master master git pull – Dannick Bedard Jan 10 '21 at 16:08
  • Georges-MacBook-Pro-2:meetlete georgeconnolly$ git branch --set-upstream-to=origin/master master Branch 'master' set up to track remote branch 'master' from 'origin'. Georges-MacBook-Pro-2:meetlete georgeconnolly$ git pull There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/ main Georges-MacBook-Pro-2:meetlete georgeconnolly$ – Rob Connolly Jan 10 '21 at 16:10
  • what is the result of : git branch -a – Dannick Bedard Jan 10 '21 at 16:13
  • Georges-MacBook-Pro-2:meetlete georgeconnolly$ git branch -a * main master remotes/origin/main remotes/origin/master Georges-MacBook-Pro-2:meetlete georgeconnolly$ – Rob Connolly Jan 10 '21 at 16:14
  • git branch --set-upstream-to origin/master or git branch --set-upstream-to remotes/origin/master – Dannick Bedard Jan 10 '21 at 16:16
  • and then you can git pull and git push your code – Dannick Bedard Jan 10 '21 at 16:16