Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

checkout a repository ON the remote?

so my situation is:

  • i have a server that i can ssh into. a remote repository (git init --bare) exists here
  • i have multiple people with local repositories on their machine, connected to this remote repository
  • i need to use the server to host the files of the main branch of the repostory

therefore, i am looking for a command to tell git to checkout a branch of the remote repository onto the remote (so this is local, in the server’s perspective). i’ve tried just normal checking out, but it seems git requires a working directory which isn’t available the way the remote repository was initialized. how can i achieve this?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Do it exactly the same way you would do it if you were hosting the files of main on a different machine. Just cd into a free spot on the server and say git clone <remoteRepo>. This will automatically checkout main so you’re all set. And from now on, you just git pull from time to time to bring those files up to date.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading