Stéphane Ripa
Stéphane Ripa

Reputation: 11

Issue CI GitLab on deploy stage

I have an issue with my CI pipeline on GitLab, stage deploy on server Cloudways. The CI deploy correctly in prod... but it failed with error:

error: could not lock config file /home/123456.cloudwaysapps.com/xxxxxxx/.gitconfig: Permission denied

I read it's a problem with .gitconfig.lock, but I don't see any file "gitconfig.lock" or .git config at this path.

What do you think about this, please? What is the error?

deploy:

stage: deploy
  
before_script:
    - apt-get update -y && apt-get install -y git openssh-client
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh

script:
    - ssh -o StrictHostKeyChecking=no $APP_USER@$APP_HOST "cd public_html/ && git config --global user.name "my-user-name" && git pull origin main && composer dump-autoload && php bin/console d:m:m -n"

only:
    - main

The screen here:

error

Upvotes: 1

Views: 214

Answers (1)

VonC
VonC

Reputation: 1323115

As commented, the git config is not needed for a pull.

But still, to investigate more, replace it with a ls -alrth $HOME && id -a, in order to:

  • check there is a ~/.gitconfig
  • see if you need to change its chmod to make it writable

Upvotes: 1

Related Questions