When I first ran my rails generator it created a folder inside of the folder I wanted to have my repository work from. What I mean by this is my github folder structure looks like this:
https://github.com/milosbunijevac/medRails
the medtools folder has the entire project, but the initial repository was started one level above the medtools folder as the repository above shows.
When I run the following commands:
heroku create
heroku buildpacks:add --index 1 heroku/nodejs
heroku buildpacks:add --index 2 heroku/ruby
and then git push heroku master from the root directory (one level above medtools) I get an error saying that app not compatible with buildpack and that the push was rejected. I'm thinking it has something to do with this strange folder structure. Do you guys and gals have any insights as to how I might fix this issue and get my project to deploy to heroku?
You could locally move everything one level up, and push back to GitHub, done in a bash session:
cd /path/to/repo
git mv medtools/* .
git rm medtools
git add .
git commit -m "move medtools content"
git push
As the OP Milos comments below, you might have to tweak the .gitignore content.
Related
I referenced this awesome thread from the following to fork my Heroku app and clone the github repo to have two seperate github repo's and Heroku app's for production and development.
Trying to heroku git:clone after heroku fork yields an empty repository
$ git clone git#heroku.com:oldapp.git -o old newclonedapp
$ cd newclonedapp
$ heroku git:remote -a newclonedapp
$ git push heroku master
I then manually moved my folder newcloneapp into its own directory. Regardless, I still get the following errors:
! Multiple apps in folder and no app specified.
! Specify app with --app APP.
How can I fix this ?
As the error message says, include --app newcloneapp in the command you are running to ensure it works with the right heroku application.
By copying the newcloneapp folder into its own directory, you are still retaining the git config for the application; hence the multiple heroku apps in this folder.
You can remove one of the applications by editing the .git/config file and removing one section with the url = git#heroku.com:your-app-name.git line.
In one of my heroku apps, I have the following config in the .git/config file:
[remote "staging"]
url = git#heroku.com:my-app-name.git
fetch = +refs/heads/*:refs/remotes/staging/*
[remote "production"]
url = git#heroku.com:my-app-name.git
fetch = +refs/heads/*:refs/remotes/staging/*
With this in place, I can push to both staging and production from the same repo. Looks like you need only one app in the folder; so you should have only one of the above sections.
This question already has answers here:
Upload to heroku without git
(3 answers)
Closed 8 years ago.
I was doing the Ruby on Rails tutorial by Michael Hartl and after finishing all the chapters, I run the app on my local server and it worked.
Whenever I tried pushing it on github, I get message like "nothing to commit, working directory clean".
Now I want to deploy it on heroku. I have tried but it did not work. Is there another way to deploy to heroku without version control ? Or should I just restart my application from zero ?
How should I go about fixing the git problem ?
Yes you can deploy to heroku without using git.
You can use a plugin heroku push. You can find it at https://github.com/ddollar/heroku-push.
There is not another way to deploy to Heroku.
Git is a powerful decentralized revision control system, and is the means for deploying apps to Heroku.
(Emphasis added.)
It's not necessary to restart your application in order to deploy it to Heroku though. You can deploy by initializing a Git repository in your application's directory, "committing" your application in its current state, then "pushing" that commit to Heroku. To begin tracking your application in Git (assuming Git is installed), run the following commands at your command line:
$ cd myapp
$ git init
Initialized empty Git repository in .git/
$ git add .
$ git commit -m "my first commit"
Created initial commit 5df2d09: my first commit
44 files changed, 8393 insertions(+), 0 deletions(-)
create mode 100644 README
create mode 100644 Procfile
create mode 100644 app/controllers/source_file
...
For more information, see Heroku's article, Deploying with Git.
I pushed my chapter 5 version of Sample_App to git, and then when I 'git push heroku' I get:
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
! No such app as sample_app.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have read through some of the similar stackoverflow questions, and so I know to look at the 'git remote -v':
heroku git#heroku.com:sample_app.git (fetch)
heroku git#heroku.com:sample_app.git (push)
origin git#github.com:jeffbenner/sample_app.git (fetch)
origin git#github.com:jeffbenner/sample_app.git (push)
I have tried removing heroku and re-pushing - I get the same error message.
I looked at 'git config -l':
user.name=jeffbenner
user.email=xxxxx#gmail.com
alias.co=checkout
push.defaults=simple
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=false
remote.origin.url=git#github.com:jeffbenner/sample_app.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
remote.heroku.url=git#heroku.com:sample_app.git
remote.heroku.fetch=+refs/heads/*:refs/remotes/heroku/*
I cannot figure out why I cannot push to Heroku. I have re-logged into both my Github and Heroku accounts through the CLI. Any direction would be much appreciated.
I just came across the same problem. I did the following:
cd .git
vim config
removed all lines referencing Heroku
cd ..
heroku create
git push heroku master
... And voila, it worked.
Hoped this helps.
Did you try to specify the branch that you are pushing. Try git push heroku master. You can read about the warning in the docs. Let me know if it worked
Edit
I would just start over all together and create a new Heroku address. Follow these steps in order
First in your Gemfile create these groups
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Important, make sure you are in the root of your project and make sure you run bundle install like this
bundle install --without production
now git add . then git commit -m 'your commit message'
now run heroku login from the command line
now run heroku create
then git push heroku master
finally heroku open will open your app in your browser
If all of this doesn't work then move the app into a new directoy and start all over by first git init, git add . and git commit -m 'first commit in new location' and follow the steps above starting with heroku login
Note that heroku and github both use git but are independent entities. If you can push your code to github and you see it on github, then you should be able to push your code to heroku with no problem. If not you may be doing something wrong with git locally on your computer.
I had no idea why, but stopping running foreman in my local machine allowed a push to heroku master... Could be coincidence :|
please help me,
when I want to upload an rails app to heroku I do this sequence and works creating a new project on heroku
git init
git add .
git commit -m "init"
heroku create
git push heroku master
and then I get a new url like http://-somethingdiferent-.herokuapp.com each time that I need to deploy an project
I dont know how to use that project later without creating other new heroku project
I was thinking to use something like pull of git, but I dont know how is the pull on heroku, maybe -git pull heroku master? but in that case, how can I pull the same project?
please I will like if you know the sequence or any tutorial?
thanks
Try to create an app first
# run this command from the app folder to create a new app
$ heroku open --app the-app-name
# Add it to the remote
$ heroku git:remote -a the-app-name
# push app to heroku
$ git push heroku master
the-app-name shall be replaced by the application name.
one can find more useful stuff here.
Im developing a rails app. Following this tutorial here:
Tutorial
I finished a part and wanted to push all the changes up to heroku and view them there. I can view the site on my local machine. On heroku all I see is this:
I typed in the following commands after I made my changes, saw the site was working on my local computer.
$ git add .
$ git commit -m "Finish layout and routes"
$ git checkout master
$ git push
$ git push heroku
$ heroku open
I even looked at the heroku logs but couldn't make sense of whats going wrong! There is no content in my database, its empty. I just have views setup.
Why did you checkout to master? Are you working on another branch?
If that is the case, you will need to merge your changes to master before pushing your code (supposing you are on master which is already the case after the checkout):
git merge other-branch
Also don't forget to migrate your database on heroku.
heroku rake db:migrate
EDIT
To find out your current branch, type:
git branch
It will mark the current branch with a '*'.
If you have removed the public/index.html file, you'll have to do git rm public/index.html as well, then commit and push to Heroku. If you delete a file locally, git won't pick up on that without doing the git rm, and Heroku's knowledge of your app is 100% through Git.
I had a similarly strange (but unrelated) problem when I had an app that was storing uploaded files on Heroku. Every time I'd do a push they'd all go away. It confused me greatly until I realized that Heroku essentially wipes every time you do a push, and anything that isn't in git isn't kept. A good reason to use S3 or similar for uploaded file storage.