On Feb 12, 6:40 am, Daniel Trezub <daniel...@gmail.com> wrote:
> Hi,
> I've been working with git in my local repo for some months already (i.e.
> there is already a bunch of commits and some branches), and I'd like to use
> git to integrate with my online server (use git pull, push, clone, fetch,
> etc).
> How should I start? Is there a way to do this without messing with my local
> history and without the risk to kill my live site?
> I've tried setting a remote repo (git add origin ssh:user@server) and doing
> a 'git pull' while on the branch i'd like to sync with the online server,
> but it created another branch. Is it ok? Or should I use git fetch?
> After that, what should I do to upload my changes without risking to kill my
> live site? I have a branch named 'master' that is supposed to be my release
> branch.
> I think I am doing ok with my local repo and git, but the remote part is
> still a mystery to me.
> Thanks for your help, pals!

The first step is to take backup of your local repo. It's always good
to have your release/master branch to have a linear history. If not
already, you could make it so by cherry-pick/rebase Git commands.
Having done that, you could add the server to which you want to push
to, as a remote branch, using Git remote command:

git remote add origin <remote_server>

Here you're calling the remote server as origin by convention, but you
can put anything sensible there. <remote_server> can take various
forms, depending on your access method. For example, it could be


For first method, you would most likely have a ssh public key which
you should add to the SSH agent; for ssh methods, you'd be prompted
for a password.

If everything went fine, you should do

git push origin master

(which tells Git to push local master branch to the remote named
origin) and you're done. You could launch gitk to see that your
branches master and origin/master are at the same commit.



You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to