In today's competitive and dynamic economy, knowledge‐intensive organisations constantly face challenges for sustenance. Therefore, successful knowledge management (KM) system is viewed as an important factor to maintain competitive advantage. These days, knowledge‐sharing practices are encouraged in organisations to improve performance of the human assets. However, the behaviour of employees determines the success of potential KM system of organisations, which often fails due to various organisational and individual factors. On the basis of prior literature, this paper investigates the effect of varying internal and external dimensions, which are contextual factors, knowledge‐sharing mediums (KSM), and knowledge‐sharing intentions on knowledge‐sharing behaviour (KSB) of employees. Data were gathered from a sample of 231 managers of various public sector units in India. The results are analysed using hierarchical multiple regression. The outcomes of this study show the impact of contextual factors and KSM on KSB. Further analysis leads to the conclusion that there is a moderating effect of knowledge‐sharing intentions on this relationship. This research intends to contribute the understanding of KSB to help managers in promoting knowledge sharing and hence developing knowledge base in organisations. This study will also encourage better managerial practices to build an environment for knowledge dissemination. Moreover, it also provides insight related to importance of KSM in promoting efficient KM processes, making this article important for both practitioners and academicians.