我在 master 分支上尝试了 git push ,但它只是显示我有新的拉取请求,但是当我单击新的拉取请求时,它会比较更改但没有显示任何将这些更改添加到存储库的选项。它只显示我所做的更改。
但是当我输入命令时
git push origin main
Run Code Online (Sandbox Code Playgroud)
添加到我的存储库的所有文件。
但是当我这样做的时候
git push origin master
Run Code Online (Sandbox Code Playgroud)
它不起作用。为什么?我听说他们正在用 main 替换 master。那么,他们将来会移除主人吗?
我正在尝试在 Gitlab CI yaml 配置文件中的作业之间添加需求。
stages:
- build
- test
- package
- deploy
maven-build:
stage: build
only:
- merge_requests
- master
- branches
...
test:
stage: test
needs: [ "maven-build" ]
only:
- merge_requests
- master
...
docker-build:
stage: package
needs: [ "test" ]
only:
- master
...
deploy-stage:
stage: deploy
needs: [ "docker-build" ]
only:
- master
...
deploy-prod:
stage: deploy
needs: [ "docker-build" ]
only:
- master
when: manual
...
Run Code Online (Sandbox Code Playgroud)
我已经使用 GitLab CI 在线 lint 工具来检查我的语法,它是正确的 …
考虑以下.gitlab-ci.yml示例:
build:
stage: build
script: echo "Building..."
build-doc:
stage: build
when: manual
script:
- echo "Building doc..."
- echo "build result" > output.txt
artifacts:
name: "%CI_BUILD_NAME%_%CI_BUILD_ID%"
expire_in: 1 week
paths:
- "output.txt"
deploy-doc:
stage: deploy
only:
- master
dependencies:
- build-doc
script:
- echo "Deploying doc..."
- type output.txt
Run Code Online (Sandbox Code Playgroud)
这个管道在master分支上的结果是:
deploy-doc作业日志说:
$ echo "Deploying doc..."
"Deploying doc..."
$ type output.txt
The system cannot find the file specified.
ERROR: Build failed: exit status 1 …Run Code Online (Sandbox Code Playgroud)