0

So ive been trying to move my android studio project into a git repo however i keep getting errors when following the tutorial below. the error I am getting is the following code below.

I can't find a fix for this but I've been stuck on this for hours, any help very welcome.

https://l.facebook.com/l.php?u=https%3A%2F%2Fdocs.github.com%2Fen%2Fget-started%2Fimporting-your-projects-to-github%2Fimporting-source-code-to-github%2Fadding-locally-hosted-code-to-github%3Ffbclid%3DIwAR3dfM_4PhAM4yx9RNHeO11BStdDxITZUs-vmcQL6aH7CModlDlLm3cq4rE&h=AT33o3Vh_ATrj3XHQTojCzDnUE7XfzftY0mduhS5TwU4QlT-G77kEU-RpESUjW679WB_leQ3SuKytz8zuW-mwPJm7YiaZW1NkhTGgAaD5Qu-Q_HtO9QI6jcmG7LwUDqFUTlh8w2EAuDpciixP6kAxw

My error:

$ git push -u origin main
To <repo url>
 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to <repo url>
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Claire
  • 1
  • https://stackoverflow.com/search?q=%5Bgit%5D+hint%3A+Updates+were+rejected – phd Nov 03 '22 at 20:44
  • `git pull origin main` to fetch and merge, or `git pull --rebase origin main` to fetch and rebase, or `git push --force origin main` to overwrite the remote branch with your local. – phd Nov 03 '22 at 20:46
  • Final option worked perfectly thank you! – Claire Nov 04 '22 at 12:08

0 Answers0