Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9105761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:10:47+00:00 2026-06-17T02:10:47+00:00

I want to use git in my existing project, so I created a space

  • 0

I want to use git in my existing project, so I created a space on github for it and in the project folder on my host I did the usual:

$ git config --global user.name myname
$ git config --global user.email "myemail@email.com"
$ cd myProjectFolder/
$ git init
$ git add .
$ git commit -m "first commit"
$ git remote add origin https://github.com/myusername/myprojectname.git

And then I want all the files of my project to be also on the online repository:

$ git push origin master

But I got the following much-dreaded error:

To https://github.com/myusername/myprojectname.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/myusername/myprojectname.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

Now, there is nothing I have to pull from the online repository, since there is still nothing over there. Why should I pull?

Anyhow, what exactly should I do here to have all my files online and start using git?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:10:48+00:00Added an answer on June 17, 2026 at 2:10 am

    After git remote add, the URL of teh remote repo is known in yours but not yet it’s content.

    After git fetch origin (or git pull), you’ll be able to git push since then the content of the remote repo will be known.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't want to submit projectname.project folder. Now, I use like that git add
I want to use Git and Github for the development of a project. But
In my new project I with my team will use Git. We want to
Our situation: We want to use git to manage our project files. So we've
I want to use git log in a project to view only the commits
Hello I start new project and I want to use git for source control.
After a merge I want to use git mergetool to resolve the issue but
I want to use opendiff as default diff-tool for git diff. This used to
I tend to use the bisect command in git extensively. Now I want to
I want use BYTE_ORDER macro in my Xcode project but i can't because i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.