@takeshi.kida :
Yes, it is possible to access your Git access token on a Databricks notebook. You can use the Databricks secrets API to securely store and retrieve your Git access token in your notebook.
Here are the general steps to follow:
- Set up a Databricks secret with your Git access token using the Databricks CLI or the Databricks UI.
- In your notebook, use the Databricks secrets API to retrieve your Git access token. You can do this by calling the dbutils.secrets.get function, passing in the name of your secret as the argument. For example, if you named your secret git-access-token, you can retrieve it using the following code:
token = dbutils.secrets.get(scope="my-secrets", key="git-access-token")
3 Use the retrieved Git access token in your notebook code as needed.
Note that you can also use the GIT_ASKPASS environment variable to specify your Git access token when running Git commands in your notebook. This can be useful if you don't want to retrieve the access token explicitly in your code. In this case, you can set the GIT_ASKPASS environment variable to a script that retrieves the access token from a Databricks secret and prints it to standard output. You can then configure Git to use this script as the "askpass" program by setting the
core.askpass Git configuration option.