Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
655 views
in Technique[技术] by (71.8m points)

version control - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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 [email protected]:/path/to/my_project.git
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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...