Search code examples
gitgitlabaccess-tokengit-pull

How can I pull changes from a git repository using a project access token?


I created a project access token with sufficient rights (read_repository, write_repository, read_registry, write_registry). Now I searched for a way to pull new changes to my already created repo using that token.

I found two ways to use a project access token: 1. for pulling git registry docker images: docker login -u <access-token-name> -p <access-token> gitlab... and 2. for cloning repos: git clone "https://my-project:[email protected]..., but nothing to git pull (code, not images) with an already existing/cloned repository.

Another user but me originally cloned the repo and I don't want to use their account nor my personal account to login.


Solution

  • You can use following command to pull changes with Access token:

    git pull https://{username}:{access_token}@{RepoUrl}