Leahcim
Leahcim

Reputation: 41929

Can't push changes to GitHub

Update: I couldn't get either of the first two solutions provided to work, so I'm providing more detail and setting a bounty.

I have previously forked a github project called Enki (a Rails blogging platform) and then customized it and deployed it on Heroku.

Now I want to start a new Enki blog. I can't fork Enki again, because it's already forked and customized for the first blog. I now cloned it from the author's page, and wanted to add a new repository on my github page so that I could deploy it to Heroku. Here's step by step instructions that I followed

git clone https://github.com/xaviershay/enki.git valentines
cd valentines
git checkout -b myvalentines
bundle install
cp config/database.example.yml config/database.yml
git init

Message

Reinitialized existing Git repository in /Users/mm/Sites/valentines/.git/

1) Why the existing repository? Did I do something wrong? So it's going into the same repository (as the original fork?) even though I've named it something else?

Made code changes then did

git add .
git commit -m "made code changes"
2 files changed, 193 insertions(+), 157 deletions(-)
rewrite Gemfile.lock (70%)

2) Does the fact that it's writing Gemfile.lock mean that it's not changing the branch but rather the master?

Next I created a repository on GitHub

git remote add valentines [email protected]:Username/Valentines.git
git push valentines master

As you can see I, following Ksol's suggestion, used a different word than origin but it didn't work 3) Problem - the GitHub repository 'Valentines' did not show the code changes that I made, but was rather the original gem

Upvotes: 0

Views: 464

Answers (3)

yetanothersullivan
yetanothersullivan

Reputation: 156

1) git clone will point to the original repository, regardless of the local directory you place it into to. You created a new branch w/ git checkout -b, but it's not a new git repo

2) This looks normal, rewrite is just telling you that you made a lot of changes to that file.

3) I believe this is because you didn't push the new branch to your github page

git push valentines myvalentines

you can also update your .git/config file so origin is your new location. Similarly, there's no reason your master branch need be a copy of the enki master branch, but you should keep a reference to it so you can pull future updates.

Upvotes: 0

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230336

Adding to @Katen's answer:

You can also use branches for this. For example, your forked repo could contain these branches:

master (pristine code from the author's repo. You may periodically update this)
blog1 (your first blog)
blog2 (your second blog)

This way, to begin working on new installation and customization of this blog engine, just run these commands.

// assuming that you completed and committed your work on a current branch
git checkout master // switch to original code
git checkout -b blog3 // "fork" it to a new branch and switch to that branch

Upvotes: 1

ksol
ksol

Reputation: 12235

Just use another name for your remote than origin?

Upvotes: 4

Related Questions