【问题标题】:Why does Vue code can't be pushed to github?为什么Vue代码不能推送到github?
【发布时间】:2021-10-14 14:14:19
【问题描述】:

我尝试使用以下命令推送我的项目,包括 Vue 代码。

git remote add origin <repository_url>
git add *
git commit -m "your commit message"
git push -u origin master

但是我位于vue-passport 文件夹中的所有vue 代码都被忽略了。所以,我无法将 vue 代码推送到 Github。仅供参考:我正在使用 vue-cli 与 Laravel 一起构建我的 vue 项目。

当我使用以下命令时:

git add .
git commit -m "first commit"
or
git status

它会产生错误:

On branch master
Changes were not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in the working directory)
(commit or discard the untracked or modified content in submodules)
    modified:   vue-passport (modified content, untracked content)

no changes added to commit (use "git add" and/or "git commit -a")

这是我在vue-passport 文件夹中的.gitignore

.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

这是我在 Laravel 中的 .gitignore 文件。

/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.idea
/.vscode

【问题讨论】:

  • 你能在这里粘贴一个“git status”输出和你的“.gitignore”的内容吗?会有帮助的
  • 尝试 git add . 代替 git add *

标签: laravel vue.js github


【解决方案1】:

拉取然后尝试提交

git pull

git add .

git commit -m 'Your message'

git push

【讨论】:

猜你喜欢
  • 2012-09-03
  • 1970-01-01
  • 2020-02-21
  • 1970-01-01
  • 2011-04-28
  • 1970-01-01
  • 2021-08-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多