Home > Mobile >  Push code to GitLab except package-lock.json
Push code to GitLab except package-lock.json

Time:09-29

I am working with a React project and I am going to deploy my app to Vercel, but when I push my code to GitLab I don't want to push package-lock.json because it will get error with Vercel. Does anyone know the fastest way to push code to GitLab except package-lock.json using command line?

CodePudding user response:

You should add package-lock.json to your .gitignore file. If it was previously added and committed to git, you should also remove it from there: git rm --cached package-lock.json.

CodePudding user response:

You should try to add a .gitignore file.

CodePudding user response:

Either delete the package-lock.json file and push the code to gitlab beacuse whenever you do the npm i again, this package-lock.json will be created again. Like

  • rm package-lock.json
  • git add .
  • git commit -m "your message"
  • git push origin your_branch_name

Or you can checkout the file after git add like

  • git add .
  • git checkout package-lock.json
  • git commit -m "your message"
  • git push origin your_branch_name

By the way you should try adding the package-lock.json into .gitignore file if you don't want to do the same steps again in your future deployments.

  • Related