Heroku build failing, 'fatal: Not a git repository' - node.js

I'm trying to deploy my app to Heroku but keep getting the error
fatal: Not a git repository (or any parent up to mount point /tmp) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).'
Here under the commands I type
$ git branch
-> master
$ git add -A
$ git commit -m'commit'
...your branch is up to date
$ git push
everything-up-to-date
$ heroku create drumbo
Creating ⬢ drumbo... done
https://drumbo.herokuapp.com/ | https://git.heroku.com/drumbo.git
$ heroku buildpacks:set heroku/nodejs
Buildpack set. Next release on sampleapp will use heroku/nodejs.
Run git push heroku master to create a new release using this buildpack.
$ git init (added this in because of https://stackoverflow.com/questions/16853624/git-discovery-across-filesystem-not-set)
Reinitialized existing Git repository in /Users/Berta/Desktop/Codes-senior/sampleapp/.git/
$ git push heroku master
...(fails with) - fatal: Not a git repository (or any parent up to mount parent /home/kozi) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
$ git status
On branch master
your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
$ ls -A
... .git, .github ...
There's also a decent amount of verbiage about npm-merge-driver in the terminal log. Looks like the build fails right after npm install npm-merge-driver is called -
> drumbo#1.0.0 prepare /tmp/build_77f785ef804afd5c02fbe1c7b6f209fd
remote: > npm-merge-driver install
remote:
remote: fatal: Not a git repository (or any parent up to mount
point /tmp)
remote: Stopping at filesystem boundary
(GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
remote:
/tmp/build_77f785ef804afd5c02fbe1c7b6f209fd/node_modules/npm-merge-
driver/node_modules/yargs/yargs.js:1100
However when I uninstalled the npm-merge-driver, build failed because it wasn't found.
What's happening?

Two things - you need to delete the prepare line from your package.json file (should be the line referring to npm-merge-driver,
and you need to make sure you add, commit, and push your code before you run npm run deploy - should clear anything up

Related

Git - push local repo to a new remote repository

I have a group in GitLab which has one repository under it in the remote and all works fine with that. However, I am now trying to create the following scenario:
Create new folder user1 and cd into it
git init
create new file
git add .
git commit -m "msg"
git remote add my-proj https://gitlab.com/my-proj/pro.git
git push --all -u https://gitlab.com/my-proj/pro.git
Sometimes it works and sometimes it doesn't and I can't figure out what I am doing wrong, see example below:
This one worked well:
Gilad#DESKTOP-7SI7CJF MINGW64 /f/proj-uzip/my-proj/user1
$ git init
Initialized empty Git repository in F:/proj-uzip/my-proj/user1/.git/
Gilad#DESKTOP-7SI7CJF MINGW64 /f/proj-uzip/my-proj/user1 (master)
$ git add .
Gilad#DESKTOP-7SI7CJF MINGW64 /f/proj-uzip/my-proj/user1 (master)
$ git commit -m "msg"
[master (root-commit) c98d5d4] msg
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 New Text Document.txt
Gilad#DESKTOP-7SI7CJF MINGW64 /f/proj-uzip/my-proj/user1 (master)
$ git remote add my-proj https://gitlab.com/my-proj/pro.git
Gilad#DESKTOP-7SI7CJF MINGW64 /f/proj-uzip/my-proj/user1 (master)
$ git push --all -u https://gitlab.com/my-proj/pro.git
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 216 bytes | 216.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote:
remote:
remote: The private project my-proj/pro was successfully created.
remote:
remote: To configure the remote, run:
remote: git remote add origin https://gitlab.com/my-proj/pro.git
remote:
remote: To view the project, visit:
remote: https://gitlab.com/my-proj/pro
remote:
remote:
remote:
To https://gitlab.com/my-proj/pro.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'https://gitlab.com/my-proj/pro.git'.
This one failed:
Gilad#DESKTOP-7SI7CJF MINGW64 /f/proj-uzip/my-proj/user1 - Copy
$ git init
Initialized empty Git repository in F:/proj-uzip/my-proj/user1 - Copy/.git/
Gilad#DESKTOP-7SI7CJF MINGW64 /f/proj-uzip/my-proj/user1 - Copy (master)
$ git add .
Gilad#DESKTOP-7SI7CJF MINGW64 /f/proj-uzip/my-proj/user1 - Copy (master)
$ git commit -m "hi"
[master (root-commit) 6c9fe76] hi
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 New Text Document.txt
Gilad#DESKTOP-7SI7CJF MINGW64 /f/proj-uzip/elixir-group/user1 - Copy (master)
$ git remote add ty https://gitlab.com/my-proj/ty.git
Gilad#DESKTOP-7SI7CJF MINGW64 /f/proj-uzip/elixir-group/user1 - Copy (master)
$ git push --all -u https://gitlab.com/my-proj/ty.git
remote: You are not allowed to push code to this project.
fatal: unable to access 'https://gitlab.com/my-proj/ty.git/': The requested URL returned error: 403
I did them both one after the other, same process not sure why sometimes it works and sometimes not
It seems like the issue is with GitLab preservation of old deleted repositories. What happened is that my repository was already created some time ago and I deleted it, however, it is still in 'Pending Deletion' state which I assume means that GitLab still sees it as active in some way.
So once I tried to create a new repository with the same name GitLab told me I can't access it, but once I created a new repository that wasn't been created before it worked.
So I guess this is how it works in GitLab but I find it weird that they are working this way.

https://git.heroku.com/whatsapp-clone5.git [remote rejected] main(pre-recei) failed to push some refs to 'https://git.heroku.com/whatsapp-clone5.git'

hello I'm trying to build my project for Heroku
I use React.js, Node.js and MongoDB
when I write those commands :
heroku login
git init
heroku git:remote -a whatsapp-clone5
git add .
git commit -am "make it better"
git push heroku main
This error appears to me
Heroku is likely not recognising the type of application you are pushing. Output of $ heroku logs would help diagnose the issue.
You might need to manually configure the buildpack

git does not commit the backend and the client files becaues they have another git repos inside if them

I finished building the backend (using NodeJS), and the frontend (using ReactJS), but I put them in different repositories. Now, as I am going to deploy them, I arranged them in a specific structure as guided.
final-project
|
---backend <--- restful API
|
---the-tech-blog <--- react app
|
---README
I initialized a new git repository using git init, and I am trying to push everything to this one repository so I can deploy it to Heroku. However, both of my files are committed empty because they have other git repositories inside them.
I read about git submodule and try to add them inside my files:
$ cd ./backend
$ git submodule add -b master https://github.com/MohamadHanafi/theTechBlog-backend
$ cd ..
$ cd ./the-tech-blog
$ git submodule add -b master https://github.com/MohamadHanafi/theTechBlog
I committed again in the main file (final-project), but again nothing changed.

How to update Heroku along with Github after the first time commit and creating Heroku app?

I have created my Heroku app via github with first commit by following commands.
git init
git add .
git commit -m "my first commit"
heroku login
heroku create
git push heroku HEAD:master
My app got created successfully. But I don't know which commands to use after then - if again i want to deploy it after making some changes in my existing code? What are the exact commands then for github and heroku both respectively.
You can re-deploy your app with the same commands you have done before.
Commands
git add .
git commit -m "new commit"
git push heroku master
Use git push for GitHub

Error while pushing from bitbucket repo to heroku. It says my repo is a shallow clone

I created a pipeline to deploy my code from Bitbucket repo to Heroku server.
my bitbucket-pipelines.yml
image: node:10.15.3
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- npm install
- git push https://heroku:<my heroku api key>#git.heroku.com/<my heroku app's name>.git HEAD
After pushing my code to my bitbucket repo, the pipeline runs, but fails while pushing the code to heroku git.
Below is the error:
Push rejected, source repository is a shallow clone. Unshallow it with `git fetch --all --unshallow` and try pushing again.
But then by bit bucket repo is not shallow. The command git rev-parse --is-shallow-repository returns false.
You can use the following git command before the push
git filter-branch -- --all
So it would be in your script:
...
- git filter-branch -- --all
- git push https://heroku:<my heroku api key>#git.heroku.com/<my heroku app's name>.git HEAD

Resources