I am facing some issue. I was trying to push my total project into my bit bucket repository but it failed.its showing me the following message.
To ! [rejected] master -> master (fetch first)
error: failed to push some refs to '
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 was running the following commands in terminal to commit my all project code.first I move to my project directory in local machine.
1-git init
2-git add -A
3-git commit -m "Initial Commit"
4-git status
5-git remote add origin
6-git push -u origin masterHere I need to push all my project code into the single repository means i have the repository name oditek_project and i want to my multiple projects (i.e-project1,project2.....) into this repository. Please help me to resolve this issue.
1 Answer
When you create a new repository on BitBucket, it creates a REAME file. So before you can push, you have to pull it first.
Just use git pull first like:
git pull -u origin masterAfter this you can push your changes
git push -u origin masterPS: When you use git, just read the hints and you can find the solution in various cases.