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

I have a git repository installed on my computer. I also have a remote machine that I can log into. I want to clone a repo to a remote machine (and then sync them up with push and pull). How should I do it? I just cloned from GitHub.

+3


source to share


1 answer


1) Initialize the bare

git repository on the 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) Set up your local repo to be able to pull / push from a remote device.



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

      

Both computers are now in sync.

+3


source







All Articles