Having problem in Github and remote Git repo with production and development code

0 votes

I am having my local Git repo which I am pushing and pulling to Github with my team as a central repository.

I am also having a remote staging area which has the whole bare repository and post-receive hook which pushes my changes to the web.I am using git push staging master for this which puts site to the staging area.

I don't want my dist/ stuff in the Github repo as this is causing many conflicts and doesn't need to be there, but I do want it in my remote website repo for production. How can I resolve this issue?

I've already tried setting up separate .gitignore files for each remote, but this doesn't make sense as it almost defeats the point of Git. Can anyone help me with this.

Apr 10, 2018 in Git & GitHub by Atul
• 10,240 points
74 views

1 answer to this question.

0 votes

I think you could start with this.

The thing you want is to always ignore the dist directory and make the server (staging or prod) trigger a npm install after it has checked out the latest version.

If you are using yarn or npm v5, commit the yarn.lock or package-lock.json file that it generates.

Then, make it trigger your gulp build with npm's post-install hook.

You can also go with using husky, a npm module which automatically installs itself in the .git directory, letting you define and version git hooks based on commands in the scripts attribute of the package.json.

"scripts": {
  "postcheckout": "npm install", // <-- Git hook from Husky
  "postinstall": "gulp build"    // <-- default npm hook
}
I hope it will resolve your query.
answered Apr 10, 2018 by shubham
• 6,890 points

Related Questions In Git & GitHub

0 votes
1 answer

Configure Git and GitHub

In version control with Git, we deal ...READ MORE

answered Apr 26, 2018 in Git & GitHub by DragonLord999
• 8,380 points
33 views
0 votes
1 answer

meaning of check-in code in github

It simply means to upload code to ...READ MORE

answered Apr 29, 2018 in Git & GitHub by ajs3033
• 7,280 points
135 views
0 votes
2 answers

difference between git remote and git clone

git remote add just creates an entry in ...READ MORE

answered Aug 7, 2018 in Git & GitHub by Kalgi
• 41,660 points
770 views
0 votes
1 answer

How to add a remote git repository in Jenkins

Follow these steps: Step 1 Go to Manage ...READ MORE

answered May 23 in Git & GitHub by Alok
84 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
180 views
0 votes
1 answer
0 votes
1 answer

Trying to analyse Sonarqube from Drone.io in Github PRs

Just try the below steps.The DRONE_PULL_REQUEST environment variable has ...READ MORE

answered Jun 27, 2018 in Git & GitHub by shubham
• 6,890 points
202 views
0 votes
1 answer