I want to store the Splunk dashboard code in Gitlab or Bitbucket so I do not lose the dashboard. Any ideal if its possible?
One idea is to do so manually - hey you asked for "any" idea😉 (No I don't think there's an automatic method.) You can make respective directories a repo, then, after update, push your code. Potentially you can monitor change, but to automatically push on change might be risky.
OK, here's a throwaway idea: You can also use Splunk to monitor the directory so any change will be ingested. Someone asked a question about showing diff in Splunk not long ago. The the possibility is a qualified yes, but the degree of capability is certainly far below any version control software.