Minh Huy
Minh Huy

Reputation: 59

Push code to GitLab except package-lock.json

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?

Upvotes: -1

Views: 3928

Answers (3)

Tikam Chand
Tikam Chand

Reputation: 96

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.

Upvotes: 1

You should try to add a .gitignore file.

Upvotes: 0

Mureinik
Mureinik

Reputation: 311798

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.

Upvotes: 2

Related Questions