cs531-f19 / discussions

Discussions board for CS 431/531 Web Server Design course
2 stars 12 forks source link

Git push issue from local to remote #22

Open choudhurym opened 5 years ago

choudhurym commented 5 years ago

Good Afternoon Sawood,

The following commands I ran to push the files from my local computer to GIt. 1.) I went to the directory where the source code and the Dockerfile exist. 2.) git init 3.) git remote add origin https://github.com/choudhurym/CS531-WebServerDesign.git 4.) git remote -v 5.) git add . 6.) git commit -m "initial commit" 7.) git push origin master

After that, the following message I am getting:

To https://github.com/choudhurym/CS531-WebServerDesign.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/choudhurym/CS531-WebServerDesign.git' 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.

I will appreciate your help in resolving this issue. Thank you, Muntabir

ibnesayeed commented 5 years ago

This usually means that your remote repository (on GitHub) has some commits that were not pulled locally before attempting to push local changes up.

Since you are new to this, I would suggest you make a backup of your code changes you made locally in another directory first. Then run a git pull command to ensure upstream commits are available locally. This may cause some conflicts in the code, which you can manually resolve one by one and then commit your changes and push to origin. Let me know how it goes.