Reputation: 3592
I'm new to Git and I think this issue has been asked before but I'm not sure:
I'm developing on my local machine and I want to create a remote repo so that each time that I want to deploy i'll just hit git pull origin master
, so:
bare
repo on the remote serverremote
on the local git repoThat means I have a working copy on the local AND on the remote machine.
Now, when I want the remote to pull the changes, I am pushing from my local machine to the bare repo and then pulling them from bare to working on the remote?
Is it correct to have a bare repo and these two working copies will work with that bare repo?
How can I make both working copies synced [remote/local]?
When I tried to pull changes [bare > local] I got
Updates were rejected because the tip of your current branch is behind
Upvotes: 0
Views: 107
Reputation: 26495
Yes, you are correct. You need a bare repository and two non-bare ones. One on your dev box for pushing your changes and one on your server to pull them.
To sync the repositories you either do a manual pull on the second repository, or use a git hook to pull automatically after each push.
The "Updates were rejected" message should only happen when pushing to a repository which contains new commits from other people. - Please edit the question to add the exact command you typed and its output.
Upvotes: 1