I want to push my commit from repository to different repository in deploy stage but I did not do it.
deploy-job:      
  stage: deploy  
  before_script:
    - 'which ssh-agent || ( apt-get update -qy && apt-get install openssh-client -qqy )'
    - eval `ssh-agent -s`
    - echo ${SSH_PRIVATE_KEY}
    - echo ${SSH_PRIVATE_KEY}
    ## Create the SSH directory and give it the right permissions
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "$SSH_PUBLIC_KEY" >> ~/.ssh/id_rsa.pub
    - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
  script:
    - git branch -a    
    - git config --global user.email "${CI_EMAIL}"
    - git config --global user.name "${CI_USERNAME}"
    - git add .  
    - git commit -m "Compiled PDF from $CI_COMMIT_SHORT_SHA [skip ci]" || echo "No changes, nothing to commit!"
    - git remote rm origin && git remote add origin http://USERNAME:${USERNAME_password}@ip:3000/USERNAME/first_exe.git
    - git branch -a
    - git push -f -u origin main
But I take this error:
To http://ip:3000/username/first_exe.git
 ! [remote rejected] main -> main (shallow update not allowed)
error: failed to push some refs to 'http://USERNAME:${USERNAME_password}@ip:3000/USERNAME/first_exe.git' 
What is the problem?
Thanks.
 
    