Search code examples
linuxgitgithubserverbare

How do i add and sync my local git on server? What is bare repo?


I am using git from a long time but never set it up on server. Refereeing to this Git: move existing repository from PC to server, clone from server

I have initiate a bare repo on server but while adding origin in local "git remote add origin server:path/to/repo" i have no idea what to add here. My site is getwalkwel.com and user is getwamld

Thanks


Solution

  • Origin is the name of a remote which is typically created automatically when you clone a repo from another repo. The origin reference in the cloned repo will be created to point back to the repo that was cloned from. In your case, where the bare repo was actually created later from your working repo, you will create origin in your working repo to point back to your new bare repo. This is done with:

    git remote add origin /barerepo/fullname

    If your bare repo is going to line on a different machine, then you need the URL to reach the repo instead of just a file path.

    For instance, you might have myuser@myserver:path/to/repo