-2

Hello Im new on gitlab so i want to push a folder on gitlab however i cant do the task because its give me some error
its says

[Rejected] master -> master (non-fast-forward)
Error: failed to push some refs to '*https://gitlab.com/sen-flutter.git*'
Hint: Updates were rejected because the tip of your current branch is behind Hint: Its remote counterpart. Integrate the remote change (e.g. 'git pull ...')
before pushing again.
Hint: See the 'Note about fast-forwards' in git push --help' for details

I have try any tutorials on youtube but it didnt go very well
Hope someone fix it for me
Thanks before

torek
  • 448,244
  • 59
  • 642
  • 775
  • 3
    The answer is in the git output. _"Hint: Updates were rejected because the tip of your current branch is behind Hint: Its remote counterpart. Integrate the remote change (e.g. 'git pull ...') before pushing again."_ – evolutionxbox Aug 24 '21 at 09:15
  • i tried it to follow the hint on youtube before this error appear its shows git error fetch first and now this error appear – Handika Pramudya Putra Aug 24 '21 at 09:16
  • 2
    Fetch isn't enough. – evolutionxbox Aug 24 '21 at 09:17
  • 1
    Does this answer your question? [What is the difference between 'git pull' and 'git fetch'?](https://stackoverflow.com/questions/292357/what-is-the-difference-between-git-pull-and-git-fetch) – evolutionxbox Aug 24 '21 at 09:18
  • 2
    Git doesn't push folders; it doesn't even *store* folders. Git stores files inside commits, and `git push` pushes those *commits*. (The files may have names that cause another clone to create folders to store those files into, but they're just files.) – torek Aug 24 '21 at 09:20
  • You should use `git pull origin master` and try to push again `git push origin master` to push a folder `git add folder_name/` and `git commit -m "mesaage_name` and push to remote host – Eng_Farghly Aug 24 '21 at 12:02
  • https://stackoverflow.com/search?q=%5Bgit%5D+Hint%3A+Updates+were+rejected+because+the+tip+of+your+current+branch+is+behind – phd Aug 24 '21 at 12:59

1 Answers1

1

Firstly, before continuing to work you need to run git pull in order to pull the latest remote changes to your local branch. Then you should be able to commit/push files to gitlab. However, you can't just commit/push an empty directory. You can only commit/push files so you will need to create a file in the directory and then commit/push that file in order to see the file and directory on gitlab.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Joshua Zeltser
  • 488
  • 2
  • 9