2

I am trying to push my django project to Gihub

I have installed Github for windows and Git CLI

and followed all the steps

  1. First created a Repo on github with a ReadMe file (default)
  2. Created one simple django application
  3. git init
  4. git add .
  5. git commit -m "First Commit"
  6. git remote add origin https://github.com/eMahtab/DjangoProject.git
  7. git push origin master

But in last step I am getting error

To https://github.com/eMahtab/DjangoProject.git

! rejected        master -> master (fetch first)

error: failed to push some refs to https://github.com/eMahtab/DjangoProject.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.
Praxis Ashelin
  • 5,137
  • 2
  • 20
  • 46
Mahtab Alam
  • 607
  • 2
  • 9
  • 22
  • possible duplicate of [Cannot push to github - keeps saying need merge](http://stackoverflow.com/questions/10298291/cannot-push-to-github-keeps-saying-need-merge) – Andrew C Apr 25 '15 at 10:15

3 Answers3

0

Try to do:

git pull 

Then you can push.

ElTête
  • 555
  • 1
  • 5
  • 15
0

If a git pull does not solve your problem, try cloning the project first and copy your code into the cloned project. Proceed as normal. This way git should do the configuration of the remote tracking master branch for you. You just have to do a git push in the end.

NaN
  • 7,441
  • 6
  • 32
  • 51
-1

Omit master because the master is for Mac, if you want to use the command then type git push origin

screenshot

Dani3le_
  • 1,257
  • 1
  • 13
  • 22