解决 Git lab Runner 的 remote origin already exists 错误

Resolve remote origin already exists error at Git lab Runner

我在 git lab runner 终端的错误

fatal: remote origin already exists.
warning: failed to remove code/ecom_front_proj/dist/sections: Permission denied
ERROR: Job failed: exit status 1

我正在尝试通过 git runner 使用 CI CD 将我的项目部署到 AWS 服务器。第一次代码部署成功。如果我第二次提交,它会显示上述错误。

如果我删除我的跑步者并创建一个新的跑步者,它就会成功部署。 不知道如何删除已经存在的远程源文件

我的Git.yml

image: docker
> 
> services:
>   - docker:dind
> 
> stages:
>   - test
>   - deploy
> 
> test:   stage: test   only:
>     - master
>       script:
>     - echo run tests in this section
> 
> step-deploy-prod:   stage: deploy   only:
>     - master   script:
>    
>     - sudo docker system prune -f
>     - sudo docker volume prune -f
>     - sudo docker image prune -f
>     - sudo docker-compose build --no-cache
>     - sudo docker-compose up -d   environment: development

我的Docker文件

FROM node:6 LABEL Aathi <aathi@techardors.com>
> 
> RUN apk update && apk add git RUN apk add nodejs  RUN apk add nginx
> RUN set -x ; \   addgroup -g 82 -S www-data ; \   adduser -u 82 -D -S
> -G www-data www-data && exit 0 ; exit 1
> 
> COPY ./nginx.conf     /etc/nginx/nginx.conf
> #COPY ./localhost.crt /etc/nginx/localhost.crt
> #COPY ./localhost.key /etc/nginx/localhost.key COPY ./code/ecom_front_proj /sections WORKDIR sections RUN npm install RUN
> npm install -g @angular/cli RUN ng build --prod

我的docker撰写文件

version: '2'
> 
> services:   web:
>     container_name: nginx
>     build: .
>     ports:
>       - "4200:4200"
>     command: nginx -g "daemon off";
>     volumes:
>       - ./code/ecom_front_proj/dist/sections:/www:ro

我的 nginx 文件

user www-data; worker_processes 1; pid /run/nginx.pid;
> 
> events {  worker_connections 768;     # multi_accept on; }
> 
> http {    sendfile off;   tcp_nopush on;  tcp_nodelay on;
>   keepalive_timeout 65;   types_hash_max_size 2048;
> 
>   include /etc/nginx/mime.types;  default_type
> application/octet-stream;
> 
>   #access_log /var/log/nginx/access.log;  #error_log
> /var/log/nginx/error.log;
> 
>   gzip on;    gzip_disable "msie6";
> 
>       server {        #listen 8443 ssl;       listen 4200;        #server_name 
> localhost;
> 
>       #ssl_certificate      localhost.crt;        #ssl_certificate_key 
> localhost.key;
> 
>       location / {
>             root  /sections/dist/sections;
>             index index.html;
>          }
>       
>       } }

看起来你 运行 gitlab-runner 版本 11.9.0 并且它有一个 bug.

或者,您的 gitlab-runner 的安装权限不允许它更改上述路径中的文件结构,请考虑 reinstalling 或添加这些权限。