microchip
microchip

Reputation: 109

gitlab API unathorized

I tried to create a project by importing manually my git repo. I followed that tutorial : https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/raketasks/import.md

At the end I got that error : * Failed trying to create xxx (xxx/xxx.git) Errors: {:base=>["Failed to create repository via gitlab-shell"]} By reading gitlab-shell.log file I discover that access to the API is forbidden I got the following error : {"message":"401 Unauthorized"}

With that URL : https://xxx/api/v4/internal/check Do you know how can I fix this ?

Upvotes: 3

Views: 9570

Answers (2)

Inaam Gharbi
Inaam Gharbi

Reputation: 1

u need to genrate private Token :

open your account gitlab -> settings->genrate private Token

Upvotes: -1

Padma Channal
Padma Channal

Reputation: 104

You have to make a HTTP Post request in order to achieve this. Clearly, according to https://docs.gitlab.com/ee/api/README.html you do not have the authorization. This is because you are not using the Gitlab Private token.

You can go to Profile -> settings -> generate a Private token. Once generated, copy it to your clipboard and use it in your post request.

Best way to use it is by Curl: Ex:

curl --request POST --header "PRIVATE-TOKEN: XXXX -k "https://example.com//api/v4/projects/11/jobs/16863/retry"

Upvotes: 2

Related Questions