【问题标题】:Can not deploy create-react-app with token无法使用令牌部署 create-react-app
【发布时间】:2021-09-18 06:48:46
【问题描述】:

我一直在尝试部署 create-react-app,但出现错误

fatal: repository 'https://github.com/charyyev2000/Portfolio-React.git/' not found

然后我创建了一个 token 并尝试使用它进行部署,

git remote add origin https://<TOKEN>@github.com/charyyev2000/Portfolio-React.git

又报错了;

已删除存储库,再次创建并尝试部署,再次遇到相同的错误

fatal: repository 'https://github.com/charyyev2000/Portfolio-React.git/' not found

我做错了什么?或者,我packages.json的主页有问题吗?

"homepage": "https://charyyev2000.github.io/Portfolio-React",

我也无法从我的任何其他存储库进行部署。 我现在该怎么办。

【问题讨论】:

    标签: reactjs git github deployment access-token


    【解决方案1】:

    你是 Git/GitHub 工具的新人,希望你能完成这个任务。

    您的远程存储库 URL 是 https://github.com/charyyev2000/Portfolio-React

    解决方案 1: 在命令行创建一个新的仓库

    echo "# Portfolio-React" >> README.md
    git init
    git add README.md
    git commit -m "first commit"
    git branch -M main
    git remote add origin https://github.com/charyyev2000/Portfolio-React.git
    git push -u origin main
    

    方案2:(我想你会更喜欢这个方案,因为你的源代码是存在的)。

    从命令行推送现有存储库

    git remote add origin https://github.com/charyyev2000/Portfolio-React.git
    git branch -M main
    git push -u origin main
    

    让我们按照指南你看到的喜欢这个

    P/S:有时候,你需要

    git add .
    git commit -m"foo"
    git push -v
    

    或者您在控制台屏幕上看到任何指南,让我们按照您看到的指南进行操作。

    【讨论】:

    • 谢谢,伙计,第二个解决方案对我有用。我一直在使用这个步骤:
    • 我曾经使用这些步骤:git initgit add .git commit -m 'upgrade'git remote add origin https://github.com/charyyev2000/Portfolio-React.gitgit push -u origin main` 然后添加到主页:https://charyyev2000.github.io/repo-name运行命令npm install gh-pages --save-dev添加到 package.json 中的脚本:predeploy: npm run builddeploy: gh-pages -d build npm run deploy 你能告诉我这和你提供的解决方案有什么区别吗?
    • 解决方案 1: 在本地 PC 之前,您拥有 GitHub 存储库。 解决方案2:你在本地PC上有源代码,然后将文件夹变成本地git存储库,然后你推送到服务器。简单来说,什么先诞生:本地或 GitHub 存储库。
    【解决方案2】:

    您的存储库可能是私有的。

    试试这个:git remote set-url origin https://YOUR_GITHUB_USER@github.com/charyyev2000/Portfolio-React.git

    或者使用 ssh 密钥。

    https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent&ved=2ahUKEwjoysreiIjzAhVwTTABHQPHDzIQFnoECGwQAQ&sqi=2&usg=AOvVaw2B_nuIizqk0LtbV4qWtzzH

    【讨论】:

    • 不,它不是私有的。
    猜你喜欢
    • 2018-12-26
    • 2023-01-30
    • 2019-07-11
    • 2020-01-31
    • 2020-12-31
    • 2017-09-21
    • 2023-03-02
    • 2020-10-21
    • 2020-07-26
    相关资源
    最近更新 更多