Add heroku app to local repository


Type this and I think you’ll see the problem:

$git remote -v

Fix it like this:

$git remote rm heroku
$git remote add heroku git@heroku.com:app.git

Cheers.!!
Advertisements

Managing Multiple Environments for an App


Create your servers and fix your remotes

We’ll need to create both remote environments, staging and production.Since we’ll be pushing to two applications we are using the –remote argument to make two sensibly named remotes.

First create staging:
$ heroku create --remote staging

Push code to heroku:
$ git push staging master
Migrate database:
$ heroku run rake db:migrate --remote staging
Get remote inof:
$ heroku ps --remote staging
Then production:
First create production:
$ heroku create --remote production

Push code to heroku:
$ git push production master
Migrate database:
$ heroku run rake db:migrate --remote production
Get remote inof:
$ heroku ps --remote production

Linking local branches to remote apps

This pushes my local topic branch named red-bg into remote branch master on the remote repository named production.

git config remote.[remoteName].push [localBranchName]:[remoteBranchName]

$ git config remote.production.push red-bg:master

$ git push production red-bg:master -f

Also, you can do this directly with git push:

$ git push heroku +HEAD:master
$ git push -f heroku HEAD:master

That’s it 🙂


			

heroku db:push


Make sure all gems are install on your system.
sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby

gem install heroku taps sequel

sudo gem install tabs

sudo heroku db:push

OR

sudo heroku db:push –config herokuServerName

If still problem. Use below command

heroku db:pull postgres://root:@localhost/db_name

Else

sudo heroku db:pull --confirm herokuDomanName postgres://userName:@localhost/Locadatabase
 root will be database user name and db_name is database name
Good Luck.........!!

Heroku: Getting Started as a Collaborator


One of my recent client project, Client had added me as a collaborator on this working heroku. I was bit confused how will i access/pull/push my code to server. After long research and some mistakes, Finally i am able to perform all relevant operation as developer. Below are few steps we should to follow.

1. Move to your working directory.

$cd appDir

2.Check, Are you already sign-in to heroku server?

$ heroku keys

Will display all keys if you added to heroku for other account. Else you see prompt

$ heroku keys
Enter your Heroku credentials.
Email:

Here you need to Login using your collaborator email id and password. Once you get login, Heroku will add your ssh key. if not then you should to run manually

$ heroku keys:add

That’s it…..

Now you able to pull/push your code to server(Be sure you pushing your code as master OR collaborator).

Few more heroku command, May it helps some times.

1. Login to heroku.

$ heroku login

2. Logout from current session.

$ heroku logout

3.Remove unnecessary ssh key

$ heroku keys:remove KEYNAME

4. Wanted to add other collaborator(developer)

$ herku sharing:add test@gmail.com

“test@gmail.com” is email id of collaborator

5. List app info

$ heroku info

6. Remove collaborator

$ herku sharing:remove test@gmail.com

7. Push code

$ git push heroku