It is tempting for some to take all of the glory.
It is a common misconception that research is purely original. However, scientific discovery is not magically creating original work. Innovation is almost entirely based off of combining old ideas in new ways. Its about using an existing toolbox to piece together something that is more than the sum of its parts.
Innovation is based on making new connections. By embracing this realization, you become an ultimate collaborator: when you learn someone else has already found a similar set of connections, instead of brooding, you can congratulate them and add your own connections to help the idea come to fruition.
I think it worth your time to be careful that everyone who contributes to your project is properly credited, including relevant prior art.
While having a wonderful discussion with Chris Olah a few months ago, we dabbled on the topic of the purpose of communication.
We came to the conclusion that the main purpose of communication is to form connections. These connections are not just between people, they are between ideas.
The collaboration of ideas is relevant (if not crucial) to innovation, and is halted if people feel that their ideas will be stolen. If you give proper credit to those you collaborate and build off of, they will not feel like you have cheated them, and will continue to be open and help you in your quest to better the world around you.
By giving credit to those who help you, you will become a better innovator in the process.