Nof*_*ofi 95 git deployment github github-actions
我已经使用 github actions 有一段时间了,但今天我的部署开始失败。以下是 github 操作日志中的错误
Command: git
Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
Directory: /home/runner/work/stackstream-fe/stackstream-fe
Output:
fatal: remote error:
The unauthenticated git protocol on port 9418 is no longer supported.
Run Code Online (Sandbox Code Playgroud)
经过调查,我的 yml 文件中的以下部分似乎导致了该问题。
- name: Installing modules
run: yarn install
Run Code Online (Sandbox Code Playgroud)
我已经查看了此更改日志,但似乎无法理解这个问题。
其他详细信息:服务器:EC2 实例 Github 操作步骤:
steps:
- name: Checkout
uses: actions/checkout@v2
- id: vars
run: |
if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo "::set-output name=environment::prod_stackstream" ; echo "::set-output name=api-url::api" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo "::set-output name=environment::staging_stackstream" ; echo "::set-output name=api-url::stagingapi" ; else echo "::set-output name=environment::dev_stackstream" ; echo "::set-output name=api-url::devapi" ; fi
- uses: pCYSl5EDgo/cat@master
id: slack
with:
path: .github/workflows/slack.txt
- name: Slack Start Notification
uses: 8398a7/action-slack@v3
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
COLOR: good
STATUS: '`Started`'
with:
status: custom
fields: workflow,job,commit,repo,ref,author,took
custom_payload: |
${{ steps.slack.outputs.text }}
- name: Installing modules
env:
REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
run: yarn install
- name: Create Frontend Build
env:
REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
run: yarn build
- name: Deploy to Frontend Server DEV
if: ${{ contains(github.ref, 'dev') }}
uses: easingthemes/ssh-deploy@v2.1.5
env:
SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
ARGS: '-rltgoDzvO --delete'
SOURCE: 'deploy/'
REMOTE_HOST: ${{ secrets.DEV_HOST }}
REMOTE_USER: plyfolio-dev
TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
Run Code Online (Sandbox Code Playgroud)
package.json文件
{
"name": "stackstream-fe",
"version": "1.0.0",
"authors": [
"fayyaznofal@gmail.com"
],
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.34",
"@fortawesome/free-solid-svg-icons": "^5.15.2",
"@fortawesome/react-fontawesome": "^0.1.14",
"@fullcalendar/bootstrap": "^5.5.0",
"@fullcalendar/core": "^5.5.0",
"@fullcalendar/daygrid": "^5.5.0",
"@fullcalendar/interaction": "^5.5.0",
"@fullcalendar/react": "^5.5.0",
"@lourenci/react-kanban": "^2.1.0",
"@redux-saga/simple-saga-monitor": "^1.1.2",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.3",
"@testing-library/user-event": "^12.6.0",
"@toast-ui/react-chart": "^1.0.2",
"@types/jest": "^26.0.14",
"@types/node": "^14.10.3",
"@types/react": "^16.9.49",
"@types/react-dom": "^16.9.8",
"@vtaits/react-color-picker": "^0.1.1",
"apexcharts": "^3.23.1",
"availity-reactstrap-validation": "^2.7.0",
"axios": "^0.21.1",
"axios-mock-adapter": "^1.19.0",
"axios-progress-bar": "^1.2.0",
"bootstrap": "^5.0.0-beta2",
"chart.js": "^2.9.4",
"chartist": "^0.11.4",
"classnames": "^2.2.6",
"components": "^0.1.0",
"dotenv": "^8.2.0",
"draft-js": "^0.11.7",
"echarts": "^4.9.0",
"echarts-for-react": "^2.0.16",
"firebase": "^8.2.3",
"google-maps-react": "^2.0.6",
"history": "^4.10.1",
"i": "^0.3.6",
"i18next": "^19.8.4",
"i18next-browser-languagedetector": "^6.0.1",
"jsonwebtoken": "^8.5.1",
"leaflet": "^1.7.1",
"lodash": "^4.17.21",
"lodash.clonedeep": "^4.5.0",
"lodash.get": "^4.4.2",
"metismenujs": "^1.2.1",
"mkdirp": "^1.0.4",
"moment": "2.29.1",
"moment-timezone": "^0.5.32",
"nouislider-react": "^3.3.9",
"npm": "^7.6.3",
"prop-types": "^15.7.2",
"query-string": "^6.14.0",
"react": "^16.13.1",
"react-apexcharts": "^1.3.7",
"react-auth-code-input": "^1.0.0",
"react-avatar": "^3.10.0",
"react-bootstrap": "^1.5.0",
"react-bootstrap-editable": "^0.8.2",
"react-bootstrap-sweetalert": "^5.2.0",
"react-bootstrap-table-next": "^4.0.3",
"react-bootstrap-table2-editor": "^1.4.0",
"react-bootstrap-table2-paginator": "^2.1.2",
"react-bootstrap-table2-toolkit": "^2.1.3",
"react-chartist": "^0.14.3",
"react-chartjs-2": "^2.11.1",
"react-color": "^2.19.3",
"react-confirm-alert": "^2.7.0",
"react-content-loader": "^6.0.1",
"react-countdown": "^2.3.1",
"react-countup": "^4.3.3",
"react-cropper": "^2.1.4",
"react-data-table-component": "^6.11.8",
"react-date-picker": "^8.0.6",
"react-datepicker": "^3.4.1",
"react-dom": "^16.13.1",
"react-draft-wysiwyg": "^1.14.5",
"react-drag-listview": "^0.1.8",
"react-drawer": "^1.3.4",
"react-dropzone": "^11.2.4",
"react-dual-listbox": "^2.0.0",
"react-facebook-login": "^4.1.1",
"react-flatpickr": "^3.10.6",
"react-google-login": "^5.2.2",
"react-hook-form": "^7.15.2",
"react-i18next": "^11.8.5",
"react-icons": "^4.2.0",
"react-image-lightbox": "^5.1.1",
"react-input-mask": "^2.0.4",
"react-jvectormap": "^0.0.16",
"react-leaflet": "^3.0.5",
"react-meta-tags": "^1.0.1",
"react-modal-video": "^1.2.6",
"react-notifications": "^1.7.2",
"react-number-format": "^4.7.3",
"react-perfect-scrollbar": "^1.5.8",
"react-rangeslider": "^2.2.0",
"react-rating": "^2.0.5",
"react-rating-tooltip": "^1.1.6",
"react-redux": "^7.2.1",
"react-responsive-carousel": "^3.2.11",
"react-router-dom": "^5.2.0",
"react-script": "^2.0.5",
"react-scripts": "3.4.3",
"react-select": "^4.3.1",
"react-sparklines": "^1.7.0",
"react-star-ratings": "^2.3.0",
"react-super-responsive-table": "^5.2.0",
"react-switch": "^6.0.0",
"react-table": "^7.6.3",
"react-toastify": "^7.0.3",
"react-toastr": "^3.0.0",
"react-twitter-auth": "0.0.13",
"reactstrap": "^8.8.1",
"recharts": "^2.0.8",
"redux": "^4.0.5",
"redux-saga": "^1.1.3",
"reselect": "^4.0.0",
"sass": "^1.37.5",
"simplebar-react": "^2.3.0",
"styled": "^1.0.0",
"styled-components": "^5.2.1",
"toastr": "^2.1.4",
"typescript": "^4.0.2",
"universal-cookie": "^4.0.4"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"@typescript-eslint/typescript-estree": "^4.15.2",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"husky": "^4.2.5",
"lint-staged": "^10.1.3",
"prettier": "^1.19.1",
"react-test-renderer": "^16.13.1",
"redux-devtools-extension": "^2.13.8",
"redux-mock-store": "^1.5.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && mv build ./deploy/build",
"build-local": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,ts,tsx}": [
"eslint --fix"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Run Code Online (Sandbox Code Playgroud)
Von*_*onC 112
首先,这个错误消息确实预计在 2022 年 1 月 11 日出现。
\n请参阅“在 GitHub 上提高 Git 协议安全性”。
\n\n2022 年 1 月 11 日最终限电。
\n这是全面的管制期,我们\xe2\x80\x99 将暂时停止接受已弃用的密钥和签名类型、密码和 MAC 以及未加密的 Git 协议。
\n
\n这将帮助客户端发现任何旧密钥或旧 URL 的持续使用。
其次,检查您的package.json
任何git://
URL 的依赖关系,如本示例所示,已在此 PR中修复。
\n\n有4个月的警告。
\n
\n整个互联网十年来一直在摆脱未经身份验证、未加密的协议,这并不是一个巨大的惊喜。就我个人而言,我认为它不是一个“问题”,而是更多的“检测未维护的依赖项”。
\n另外,这还只是管制期,因此该协议只会在短时间内被禁用,以便开发人员发现问题。
\n永久关闭要到3月15日。
\n
如actions/checkout issues 14中所示,您可以添加以下内容作为第一步:
\n - name: Fix up git URLs\n run: echo -e \'[url "https://github.com/"]\\n insteadOf = "git://github.com/"\' >> ~/.gitconfig\n
Run Code Online (Sandbox Code Playgroud)\n这将把anygit://github.com/
变成https://github.com/
.
对于所有存储库,您可以设置:
\ngit config --global url."https://github.com/".insteadOf git://github.com/\n
Run Code Online (Sandbox Code Playgroud)\n您还可以使用 SSH,但GitHub Security提醒我们,自 2022 年 3 月 15 日起,GitHub 停止接受 DSA 密钥。2021 年 11 月 2 日之后上传的 RSA 密钥仅适用于 SHA-2 签名。
\n已弃用的 MAC、密码和未加密的 Git 协议将被永久禁用。
所以这个(使用正确的密钥)可以工作:
\ngit config --global url."git@github.com:".insteadOf git://github.com/\n
Run Code Online (Sandbox Code Playgroud)\ngit://github.com/
这会将任何(未加密的 Git 协议)更改为git@github.com:
(SSH URL)。
rsc*_*rer 77
安装前尝试使用以下命令:
git config --global url."https://".insteadOf git://
Run Code Online (Sandbox Code Playgroud)
PS 或更好(感谢@bgraves)
git config --global url."https://github.com/".insteadOf git://github.com/
Run Code Online (Sandbox Code Playgroud)
小智 19
尝试使用 https://github.com 而不是 git://github.com
@toast-ui/react-chart依赖性在这里给您带来问题。
如果你仔细观察你的 package-lock.json ,你可以回溯eve到@toast-ui/react-chart
前夕-->拉斐尔--> tui-chart --> @toast-ui/react-chart
您可以遵循相同的技术来查找项目中的更多问题。
我希望这个答案能够提供其他答案中省略的更多上下文。
Git 可以使用四种协议来传输数据:
9418
和服务请求。每个协议使用不同的 URL:
/srv/git/project.git
)file://
(例如file:///srv/git/project.git
)https://example.com/gitproject.git
ssh://[user@]server/project.git
[user@]server:project.git
git://
GitHub 已放弃对所有未加密协议的支持,其中仅包括 Git 协议(使用git://
前缀的协议)。因此,该The unauthenticated git protocol on port 9418 is no longer supported.
错误证实了这一点。
缓解这种情况的方法是git://
在您的package.json
和 锁定文件(例如yarn.lock
或package-lock.json
)中搜索字符串来识别有问题的包,并将它们升级到不使用解析为带有前缀的 URL 的依赖项的版本git://
。如果有问题的软件包不在您的 中package.json
,您可能会发现运行命令(例如yarn why
了解安装该软件包的原因)很有帮助。
如果这是不可能的,并且存储库是公共的,临时解决方案是手动替换git://
为https://
. 但此解决方案不是永久性的,并且可能会在下次写入锁定文件时被覆盖。
小智 7
在存储库的 .git/config 文件中更改git://github.com/<blah>
为git@github.com:<blah>
(注意末尾的/
\xe2\x86\x92 )。:
在我的存储库的 .git/config 文件中,我有这一行
\n[remote "upstream"]\n url = git://github.com/curlconverter/curlconverter.git\n fetch = +refs/heads/*:refs/remotes/upstream/*\n
Run Code Online (Sandbox Code Playgroud)\n我改为
\n[remote "upstream"]\n url = git@github.com:curlconverter/curlconverter.git\n fetch = +refs/heads/*:refs/remotes/upstream/*\n
Run Code Online (Sandbox Code Playgroud)\n并停止收到此错误。
\n