Hi guys,
I have a question about pushing the local directories into GitHub by Git Bash.
I have a local folder which contains a couple of sub-folders with different files in each sub-folder.
I want to push all of them onto GitHub but I can’t do it. I just could push only 1 folder which contains the files only.
The error is "error: failed to push some refs to 'https://github.com/christiesunnie/vanilla-js-projects.git’
**hint: Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes (e.g., ‘git pull …’) before pushing again. See the ‘Note about fast-forwards’ in ‘git push --help’ for details."
Can someone help me how to do this please?
P/s: I attach an example of what I meant from GitHub
Thank you so much!
Have you done a git pull
or git fetch
?
Hi. I am pretty new with GitHub and Git Bash.
Do you have any instructions for me?
It sounds like what has happened is that changes have been submitted to the remote repository. Your remote branch is “ahead” of your local one. Before you can submit your local changes, you need to get your code up to date. There are commands that let you get the most recent code from the remote repository. Here is a freeCodeCamp article to explain them:
I will tell you steps by steps I did.
I created a folder at my local laptop:
vanilla-js-projects (folder) -> beginner (folder) -> bin2dec-app (folder)
in bin2dec-app (folder) contains 3 file HTML, JS and CSS files
I used GitBash to initialize the git
git init
git add .
git commit -m “Add the folders for the projects”
git remote add origin GitHub URL
git push -u origin master
-> So at the moment, on my GitHub,
beginner folder has pushed with bin2dec-app folder inside it
However, bin2dec-app folder can’t be accessed.
Do you know what is the problem?