Ruby on rails and Heroku problem - ruby-on-rails

$ git push heroku master
I basically get this error message.
error: src refspec master does not match any.
error: failed to push some refs to 'git#heroku.com:falling-stone-505.git'
I'm very new to computer programming and ruby on rails so an "idiots" guide to solving this would be appreciated.
Thanks in advance.

You haven't committed anything to push yet. Try doing:
$ git add -A
$ git commit
Then try to push to Heroku again.
You might try following along with this tutorial, although I can't vouch for it. Most of the professional endeavors in this space are books.

If you want your commits to be easier to track in the future, after
1.
$ git add -A
2.
instead of
$ git commit
you can use
$ git commit -m "add a message here such as FIRST COMMIT or PROBLEM WITH CONTACTS VIEW ADDRESS VARIABLE TYPO FIXED."
3.
Then you can
$ git push heroku master

Related

Why is my app not pushing to bitbucket? (Michael Hartl's tutorial chapter 3 section 3.1)

I am following Michael Hartl's tutorial (chapter 3 section 3.1 https://www.railstutorial.org/book/static_pages) using cloud 9 IDE and trying to push the sample_app to bitbucket. When I type the following command into cloud 9 IDE:
Since we’ll be using this sample app throughout the rest of the book,
it’s a good idea to create a new repository at Bitbucket and push it
up:
$ git remote add origin git#bitbucket.org:/sample_app.git $
git push -u origin --all # pushes up the repo and its refs for the
first time
I get the following error
fatal: remote origin already exists.
(NOTE: I have changed username to my username).
Since I got the error I have tried several solutions including deleting everything from bitbucket fromt he previous exercises in the book. so far i have followed the instructions to the letter, although I did accidentally close some of the tabs in the command line on cloud 9 and I don't know if this made any difference. I also notice that nothing seems to have been created on git even though i did git init, git add -A and git commit. What have I missed. help is greatly appreciated so I can move on. Please let me know if there are any files I should add to an edit of this post. Thanks.
fatal: remote origin already exists.
The remote you're trying to add already exists. Run git remote -v and check in the ouput it gives to you, if is there, then skip the first command and pass the second one to push.

Github pulling does not work in - Rails 5

I'm trying to pull last commit that I made on github, and though I get no errors, I see no changes in the code. I messed up my schema file, but after I pull the code it does not change at all.
I searched here on stack and the solution that worked for others didn't work for me, and this is also my first time that I'm pulling code from github, so I could've probably done something wrong.
I used this code:
git fetch origin controller-generator
git git reset --hard FETCH_HEAD
This is what I get as the output
HEAD is now at 1fb8c97 Integrated friendly routes gem
'Integrated friendly routes gem' is my last commit that I want to pull, but nothing changes. I don't know if I need one more step or whatever it goes with it.
This is what I have in commit db file
And when I pull this, I get this
The last one should not be there.
This is output
equalsign:~/workspace/BlogAndPort/db/migrate (controller-generator) $ git reset --hard 1fb8c97d64f389904b3048fb2850fcfd8425cd36
HEAD is now at 1fb8c97 Integrated friendly routes gem
equalsign:~/workspace/BlogAndPort/db/migrate (controller-generator) $ git push -f origin HEAD
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
Everything up-to-date
The problem is still the same as shown in the pictures. db files did not change
If I understood, you are asking to reset your local/master with origin/master.
$ git fetch
$ git reset --hard origin/master
You can back (hard reset) to a commit that was working for you.
$ git reflog # copy the commit-sha where you want to back/reset
$ git reset --hard <commit-sha> # reset to the commit
Now, if all things are ok. Then Force (-f) Push to remote.
$ git push -f origin HEAD # update remote branch

Ruby on Rails tutorial chapter 1.4.3 (part about bitbucket)

I'm having some trouble setting up the bitbucket repo
humantoast#rails-tutorial:~/workspace/hello_app (master) $ git remote add origin git#bitbucket.org:HumanToast/hello_app.git
fatal: remote origin already exists.
.
humantoast#rails-tutorial:~/workspace/hello_app (master) $ git push -u origin --all
conq: repository does not exist.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I just want to say that I tried the following and it seems to have worked. Note that '<username>' refers to your username. If on a numbered list, replace <username> with your username.
Enter the numbered commands below into the terminal. 'Result' is the output the terminal showed after the command was entered
git remote -v
Result
origin git#bucket.org:/hello_app.git (fetch)
origin git#bucket.org:/hello_app.git (push)
git remote rm origin
Result
No output in the terminal
git remote add origin git#bitbucket.org:<username>/hello_app.git
git push -u origin --all # pushes up the repo and its refs for the first time
Result (note the 3 dots below refers to output on the terminal that I excluded due to it potentially containing confidential information)
.
.
.
Are you sure you want to continue connecting (yes/no)?
yes
Result
.
.
.
To git#bitbucket.org:<username>/hello_app.git
[new branch] master -> master
Branch master set up to track remote branch master from origin.
That seems to have done the trick. I wasted a day stuck so early in the book.

Git push origin master fatal error: Permission to railstutorial/first_app.git denied

I'm trying to git push origin master using Michael Hartl's rails tutorials (first_app), but i'm getting this problem:
[first_app]$git push origin master
ERROR: Permission to railstutorial/first_app.git denied to tomkim
fatal: The remote end hung up unexpectedly
I've re-entered an SSH key, but that's not it. I've never had this problem before, but now I am.
Help's greatly appreciated.
You need to add your own repo as the remote (of course you need to create a first_app repo on Github first):
$ git remote rm origin
$ git remote add origin git#github.com:tomkim/first_app.git
$ git push -u origin master
And tomkim is your github account name, right? If not, change it to yours.
I was able to figure this out. I noticed that the origin was showing "railstutorial/first_app.git", when that it should've been tomkim310/first_app.git. The problem to begin with was follow Hartl's tutorial, I was just typing as he was going. Simply doing a new "git remote add origin git#github.com:tomkim310/first_app.git" does not do the trick.
I verified this by typing in: git remote -v which gave origin git#github.com:railstutorial/first_app.git. To change it, i typed: git config remote.origin.url git#github.com:tomkim310/first_app.git.
This then did the trick and git push origin master worked.

pushing to heroku git error

I have created a brand new heroku app, beforehand i deleted the old .git file from my app's directory and created a new one with the usual steps:
git init, git add ., git commit -m "new git"
all of which worked fine. I then created a new app like so and got the following error:
$ heroku create
Creating glowing-summer-56.... done
Created http://glowing-summer-56.heroku.com/ | git#heroku.com:glowing-summer-56.
git
Git remote heroku added
$ git push heroku master
Counting objects: 1553, done.
Delta compression using up to 4 threads.
fatal: object 91f5d3ee9e2edcd42e961ed2eb254d5181cbc734 inconsistent object lengt
h (387 vs 8985)
error: pack-objects died with strange error
error: failed to push some refs to 'git#heroku.com:glowing-summer-56.git'
This is strange to me, as it is a brand new .git file. How can I get rid of this without cleaning up each damaged object? Is there a way to just delete the git file and start anew? I'm not using this git file for anything other than pushing to heroku.
Also I should note that I am using Cygwin on windows and my git version is 1.6.6.1
I've come across this error before and fixed it, I just honestly can't remember how.
Finally, using git fsck --full yields nothing :(
Thanks,
i seemingly fixed this with: git reset

Resources