taskolib / libgit4cpp

C++ wrapper for libgit2 with limited functionality
https://taskolib.github.io/libgit4cpp/
GNU Lesser General Public License v2.1
1 stars 0 forks source link

Push to a Gitlab instance #22

Open alt-graph opened 3 months ago

alt-graph commented 3 months ago

It would be nice if we could push our local git repository to a Gitlab instance. As we have – for now – excluded personal user authentication, the only way to accomplish this seems to be via access tokens.

To push using a token:

git push https://:<token>@gitlab.daisy.de/taskomat/my_repo.git main

To get the ID of a token:

curl --request GET --header "PRIVATE-TOKEN: <token>" "https://gitlab.daisy.de/api/v4/personal_access_tokens/self"
{"id":3260,"name":"taskomat","revoked":false, ... ,"expires_at":"2024-04-06"}

To rotate a token and extend its lifetime:

curl --request POST --header "PRIVATE-TOKEN: <token>" "https://gitlab.daisy.de/api/v4/personal_access_tokens/<token_id>/rotate"
{"id":3261,"name":"taskomat","revoked":false, ...  ,"expires_at":"2024-03-14","token":"<new_token>"}

The token would have to be changed automatically by the Taskomat servers every week or so.