0

Hello I am seeing below error after command git push -u origing master. Can someone kindly help

Basically i am simply trying below steps

1) Go to github.com
2) Make repository called datasciencecoursera
3) Come back to git Bash tool
4) mkdir datasciencecoursera on local pc
5) cd to directory
6) git init
7) touch HelloWorld.md
8) git add HelloWorld.md
9) git commit -m "First comment"
10) git remote add origin https://github.com/adnan2911/datasciencecoursera.git
11) git push -u origin master

but i get below error

adnan@AB-DESKTOP MINGW64 ~/datasciencecoursera (master)
$ git push -u origin master
To https://github.com/adnan2911/datasciencecoursera.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/adnan2911/datasciencecours
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 tried to search for fast-forwards but not able to understand since i am very new to git stuff

user2774120
  • 139
  • 3
  • 16

1 Answers1

2

The tutorial won't work, because there is an HelloWorld.md (which you probably should not have created, to begin with). clone it and you'll have the remote automatically added to the local repository:

git clone https://github.com/adnan2911/datasciencecoursera
Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • I had to use dot at the end else it was still giving me erros.. so i used below command git clone https://github.com/adnan2911/datasciencecoursera . But thanks alot – user2774120 Apr 06 '19 at 23:18
  • @user2774120 intentionally left the `.git` away, else this would be the directory name. – Martin Zeitler Apr 06 '19 at 23:26