There are two ways I can answer this question. I'm pretty sure one of the ways is, while technically correct, mostly worthless to you because it ignore the question you're trying to ask and focuses on the question you did ask. So let's start with that one.
The redshift used by Hubble comes from expansion only and from gravity only. In general relativity, gravity is a description of how spacetime is curved and how it behaves. The expansion of space can be written into the Einstein field equations as reacting to gravity; being driven by it, influencing it, and being influenced by it. Therefore, it is valid for us to say that redshift due to expansion is "technically" due to gravity (the LHS of the EFEs, for all you technical enthusiasts). So it is both.
Okay, the second way to answer this is more helpful to what you wanted to ask, so I thought I'd save the best for last.
The redshift Hubble measures is due to the expansion of space. One of the primary ways it measures expansion is by measuring the redshift from Type-1A supernovae, which has a spectrum and intensity that is always the same. Let me present two strong reasons why you can be sure that Hubble isn't measuring redshift due to gravity from the star or other objects along the way. Firstly, we do the math. We calculate how much redshift we should see purely due to the source star, which always has the same mass because of how these supernovae are produced. This allows us to remove it from the measurements. Second, even were we to not do this, the amount of redshift is roughly consistent for all Type-1A supernovae. So we can look for one fairly close to us, where the redshift due to expansion would be expected to be minimal, and we can then use that as a base line to eliminate gravitational redshift from ones that are further away. Any left over redshift must be due to expansion. Additionally, we know that other objects on route do not provide much redshifting because if something of large mass was in the middle of the light's path, it would gravitationally blueshift as it approached the object and redshift by (almost) exactly the same amount as it left. A net cancelling effect.
So what Hubble uses is the redshift due to expansion. And we do not assume there is no gravitational redshift, we just have very easy ways of nullifying its effects