1

I went through the procedures given when adding an existing project to GitHub using the command line:
1. Change Directory
2. git init
3. git add .
4. git commit -m "First commit"
5. git remote add origin https://github.com/fitz00/Mega-Grazio.git
6. git remote -v

But whenever i run the final command;

7. git push origin master

i always get this error:->

fatal: HttpRequestException encountered.
An error occurred while sending the request.
Username for 'https://github.com': fitz00
To https://github.com/fitz00/Mega-Grazio.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/fitz00/Mega-Grazio.git'
hint: Updates were rejected because the tip of your current branch is behind<br>
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

In the repository, there are two (2) auto-generated files LICENSE and ReadMe.md.
Please how do i bypass this error?

Brendan
  • 910
  • 1
  • 14
  • 32
  • 1
    Possible duplicate of [How to resolve git error: "Updates were rejected because the tip of your current branch is behind"](https://stackoverflow.com/questions/22532943/how-to-resolve-git-error-updates-were-rejected-because-the-tip-of-your-current) – phd Apr 19 '18 at 23:11
  • 1
    Why not just `git pull` the remote changes, as git is suggesting?! – kowsky Apr 20 '18 at 05:56

1 Answers1

2

Try the following

 git push -u origin master

EDIT

I see your repository. It already has some contents and you never pulled that information before pushing. What you can do is

git clone https://github.com/fitz00/Mega-Grazio.git
cd Mega-Grazio

Then add new contents and do commit/push

Md Johirul Islam
  • 5,042
  • 4
  • 23
  • 56
  • @Brendan Have you tried first removing the local repo completely, and then only running the git clone command in this answer? – evolutionxbox Apr 19 '18 at 23:11