gardenhead
gardenhead

Reputation: 2497

How do I clone my git reposity to a remote machine?

I have a git repo set up on my computer. I also have a remote machine that I can ssh into. I want to clone the repo to the remote machine (and then keep them in sync with push and pull). How do I do this? I've only ever cloned from GitHub.

Upvotes: 3

Views: 583

Answers (1)

romants
romants

Reputation: 3648

1) Initialize bare git repository on remote machine.

ssh remote_machine
mkdir my_project
cd my_project
git init --bare
git update-server-info # If planning to serve via HTTP

2) Configure local repo to be able to pull/push from remote one.

git remote add origin git@remote_machine:my_project.git
git push -u origin master

Now both machine are in sync.

Upvotes: 3

Related Questions