How do I do an initial push to a remote repository with Git?



I’ve read through countless tutorials and I keep coming up short. Here’s what I’ve got:

  • I’m running RubyMine on my Windows desktop
  • I’ve installed Git on my WebFaction hosting account per their instructions
  • Git appears to be working fine on both machines

Here’s what I’m doing:

  1. On server:
    • mkdir project
    • git init
    • git add .
    • git commit #==> nothing to commit
  2. On client:
    • Create new project in RubyMine
    • Git init in top directory of project
    • Push changes to server #==> failed to push some refs to...

What steps am I missing?


On server:

mkdir my_project.git
cd my_project.git
git --bare init

On client:

mkdir my_project
cd my_project
touch .gitignore
git init
git add .
git commit -m "Initial commit"
git remote add origin
git push origin master

Note that when you add the origin, there are several formats and schemas you could use. I recommend you see what your hosting service provides.

Answered By – Josh Lindsey

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More