Home > Blockchain >  checkout a repository ON the remote?
checkout a repository ON the remote?

Time:04-29

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?

CodePudding user response:

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.

  •  Tags:  
  • git
  • Related