Next.js Discord

Discord Forum

Not able to push the next app to git

Answered
nikkuv posted this in #help-forum
Open in Discord
I'm getting this error while pushing to the git repo.

The things I've tried so far =>
- deleted .next file
- added these large files to the gitignore
This is my gitignore file
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

/node_modules
node_modules
dist
dist-ssr
*.local

# next.js
/.next
.next

/node_modules/@next/swc-darwin-arm64/next-swc.darwin-arm64.node
node_modules/@next/swc-darwin-arm64/next-swc.darwin-arm64.node

# local env files
.env*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
Answered by joulev
basically what happened is: you somehow tracked node_modules in a previous commit and so gitignore had no effect. technically you could use the commands here https://stackoverflow.com/q/1274057, but when i checked your repo i see it's blank so i decided to tell you to just start from a clean slate instead.
View full answer

19 Replies

is this the correct command to delete the .git file?

rm .git
it's a folder so rm -rf .git
Thanks Getting this status
nice, looks good to me
is there one single node_modules in your proejct
or somehow there are many node_modules?
if there is one single node_modules i think you're ready to go
now continue with adding remote with git remote and do normal steps to push to github
Tried to push after adding this file
getting this now
yes you have to redo these steps again
got it...pushed my code to the branch, Thank you
Yeah 😛
nice
looks great, have fun coding
basically what happened is: you somehow tracked node_modules in a previous commit and so gitignore had no effect. technically you could use the commands here https://stackoverflow.com/q/1274057, but when i checked your repo i see it's blank so i decided to tell you to just start from a clean slate instead.
Answer