Search code examples
gitgithubgit-remote

Git push to another machine


[Remote GIT repo]----[Remote VM]----[Local Host]

I have this setup where I have a remote VM which clones a GIT repo from remote GIT repo. I have my local machine which clones the repo cloned at remote VM.

The remote.origin.url for VM is the actual remote repository URL from which all users clone.

And the remote.origin.url for my Local Host is the remote VM URL. Like -

remote.origin.url=ssh://[email protected]/path/to/cloned/repo

My doubt is if I make some changes on my local machine and commit+push. Will that push the changes to the remote VM or the remote GIT repo? I hope it pushes to the remote VM and not the remote repo.

Basically I want to work on my local machine and synchronize whatever changes I make to Remote VM. That includes local branches and committed work. So I can start the build on Remote VM and push from there to the Remote Git repo.


Solution

  • Yes, that is correct.

    Your local machine git repo does not know anything about the "Remote Git Repo". When you push your commits from your local machine, it'll be pushed to your "Remote VM".