Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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.

like image 773
gardenhead Avatar asked Nov 28 '25 11:11

gardenhead


1 Answers

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.

like image 163
romants Avatar answered Dec 01 '25 01:12

romants