Hi there.
How I can get default branch name of a project via API from these page: /-/settings/repository → Branch defaults → Default branch.
Thanks.
Hi there.
How I can get default branch name of a project via API from these page: /-/settings/repository → Branch defaults → Default branch.
Thanks.
Hi
You can use Gitlab API and jq to parse the output . for example this return the name of default branch of project with $PROJECT_ID :
curl -sS --header “PRIVATE-TOKEN: $YOUR_ACCESS_TOKEN” “http://gitlab.example.com/api/v4/projects/$PROJECT_ID/repository/branches” | jq -r ‘.[]|select (.default==true)|.name’