tags:

views:

468

answers:

1

I just jumped into Git yesterday via Github and am moving away from svn. I created a private repo that I intend to use to keep my personal projects synced between work and home. During the process of creating the remote repo, my local files from work were pushed up. Last night, I was able to pull them down to my laptop at home.

Now I added some new files to the repo directory at work. I did "git add filename" where "filename" is my file. Then I did "git commit -m 'my message'" and that seemed to work. I can't push them to the remote though. I tried 'git push personal' but got an error:

To [email protected]:geuis/personal.git ! [rejected] master -> master (non-fast forward) error: failed to push some refs to '[email protected]:geuis/personal.git'

Svn is really straight forward when it comes to this stuff. I've been trying to read through docs on how Git works, but most of it seems to assume you already know the basics.

For my situation, what are the basics I need to know? Remote repo on Github, and 2 separate checkouts at work and home that will be manually synced to the remote.

I'm on a Mac.

+5  A: 

To be able to push to the remote, generally speaking, you need to be up to date with the remote branch. Try git pull first, then git push.

Burke
That did it! So when I did my pull last night at home, did that make the remote repo out of sync with my local work repo?
Geuis
It shouldn't have. You probably pushed some changes back to the server at some point? Git makes you deal with merge conflicts locally, even if there's no conflict. you could create an empty file on one checkout, then push it back to the server. The server wouldn't accept any other commits, no matter how unrelated, from any other checkouts, until they've pulled the changes.
Burke