Geuis
Geuis

Reputation: 42267

can't push to remote Git repo

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.

Upvotes: 4

Views: 27809

Answers (1)

user64417
user64417

Reputation:

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.

Additionally, github recommends you do git push -u personal master so that the head is set remotely

Upvotes: 8

Related Questions