Tioww
Tioww

Reputation: 49

Can't push my local file into heroku with git push

Hello I logged in heroku and I want to push my own created server not their demo, I typed cd c:\server and then git push heroku master but I get this error: Not a git repository (or any of the parent directories): .git I tried push demo heroku and everything worked fine maybe problem in json files?

package.json

{
  "name": "server",
  "version": "0.2.6",
  "description": "A sample Node.js app using Express 4",
  "engines": {
    "node": "6.10.2"
  },
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "ejs": "2.5.6",
    "express": "4.15.2"
  },
  "keywords": [
    "node",
    "heroku",
    "express"
  ],
  "license": "MIT"
}

Profile

web: node server.js

app.json

{
  "name": "Start on Heroku: Node.js",
  "description": "A barebones Node.js app using Express 4",
  "repository": "https://github.com/heroku/node-js-getting-started",
  "logo": "https://cdn.rawgit.com/heroku/node-js-getting-started/master/public/node.svg",
  "keywords": ["node", "express", "heroku"],
  "image": "heroku/nodejs"
}

Thanks.

Upvotes: 0

Views: 493

Answers (2)

Aakash Uniyal
Aakash Uniyal

Reputation: 1559

What you have to do is use the same folder where you have cloned the repo in, add / remove files as needed and push from there . As you have copied only the package.json to another file , git folder and information has not been copied . Hence git does not know what is the repo to push the code to .

So , just use the same folder , It should work fine then .

If you want to use it from somewhere else then copy all the contents to the desired folder then push.

Upvotes: 1

31piy
31piy

Reputation: 23869

Your current directory is not a git repository. Navigate to your directory and run the following commands:

git init
heroku git:remote -a your_app_name

Now you can change your files, commit them and push them using

git push

Upvotes: 1

Related Questions