# Installation and Pushing Code ## I**nstallation** - At root directory of nodejs app ```bash git init git add . git commit -m 'initialize' ``` • (Make sure to install heroku cli) `• heroku create or heroku create appname` - If there is already an existing app then we need to change the prev origin to current one by: `heroku git:remote -a appname` - For changing app name, remote name has to be changed too. ```bash git remote rename heroku newname ``` or ```bash git remote heroku newname heroku git:remote -a newname ``` - For changing app name(this has to be done before) `heroku apps: rename newname` or for outside git repository `heroku apps: rename newname —app oldname` ## **Pushing Code** `git push heroku main` For non-main branch: `git push heroku testbranch:main` **In nodejs app:** ```jsx app.listen(process.env.PORT || 3000,()=>{ console.log('listening'); }) ```