【问题标题】:Cant push a Laravel application to github无法将 Laravel 应用程序推送到 github
【发布时间】:2015-12-21 02:09:51
【问题描述】:

我正在尝试将我的 Laravel 应用程序推送到 GitHub。我所做的事情在Laravelapp目录中如下:

git init
git remote add origin my@gitrepositaty.com

git commit -u 'my app'
# nothing added to commit but untracked files present

git add .
# fatal: LF would be replaced by CRLF in .env.example

git add origin master
# error: src refspec master does not match any

【问题讨论】:

    标签: git laravel github


    【解决方案1】:

    我修复的方法是在 git.config 文件中添加 autocrlf = input , safecrlf = false

    感谢您尝试帮助@macareno.marco

    【讨论】:

      【解决方案2】:

      对于初学者,将项目提交到存储库时,最好只提交对项目很重要的所有文件。
      对于 laravel 项目,您应该从 laravel 项目 root directory 中进行操作。
      也就是说,为了将您的更改提交到 git 存储库,您需要:

      git add . # Stages your changes for next commit
      git commit -m "YOUR COMMIT MSG HERE" # Commit those changes into the repo
      git push # Pushes changes to your current branch (by default master)
               # and your current remote (in this case origin after you did
               # git remote add origin my@gitrepository.com
      

      一般来说,我建议查看how a git repo works

      【讨论】:

      • 感谢 Marco 的回复,当我执行 git add 时。 #fatal: LF 将被 .env.example 中的 CRLF 替换 # 出现
      • @RiyanZaman 几个问题,您使用的是哪个操作系统?您使用什么来编辑文件(文本编辑器、IDE 等)?
      • $ git status On branch master Initial commit #all the folders show in red # Untracked files: 没有添加到提交但存在未跟踪的文件
      • @RiyanZaman 好的,出现这个问题是因为 Windows 使用不同的字符来表示行尾(\r\n instean of \n),这一切都有更好的记录here 但是在你的情况下我推荐@987654324 @,只是为了简单起见。
      • 这对哥们没有帮助..仍然没有推送到存储库
      猜你喜欢
      • 2020-10-22
      • 1970-01-01
      • 2023-03-27
      • 2018-12-12
      • 2016-05-12
      • 1970-01-01
      • 2018-02-27
      • 1970-01-01
      相关资源
      最近更新 更多