0

I am trying to push my Laravel application to GitHub. The things I have done are as followed in the Laravel app directory:

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
Sam
  • 20,096
  • 2
  • 45
  • 71

2 Answers2

2

For starters, when commiting a project to a repository it's good practice to commit all and only the files which are important for your project.
In the case of a laravel project you should do it from the laravel projects root directory.
That said, in order to commit your changes to a git repo you need to:

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

In general I recommend checking out how a git repo works

  • Thanks for the reply Marco , when I do git add . #fatal: LF would be replaced by CRLF in .env.example # comes up – Riyan Zaman Sep 23 '15 at 17:09
  • @RiyanZaman few questions, which os are you using? And what did you use to edit the files (text editor, IDE, etc)? – macareno.marco Sep 23 '15 at 17:12
  • $ git status On branch master Initial commit #all the folders show in red # Untracked files: nothing added to commit but untracked files present – Riyan Zaman Sep 23 '15 at 17:13
  • @RiyanZaman Ok, this problem arises because Windows uses a different character to signal line endings (\r\n instean of \n) it's all better documented [here](http://stackoverflow.com/questions/15467507/trying-to-commit-git-files-but-getting-fatal-lf-would-be-replaced-by-crlf-in) however in your case I recommend [configuring sublime text to use unix line endings](http://stackoverflow.com/questions/11899843/fixing-sublime-text-2-line-endings), just for the sake of simplicity. – macareno.marco Sep 23 '15 at 17:19
  • That didn't help buddy .. still does not push to repository – Riyan Zaman Sep 23 '15 at 17:26
  • @RiyanZaman did you already save the conflicting files again to have acceptable line endings + staged the files and tried to commit? – macareno.marco Sep 23 '15 at 17:30
  • @RiyanZaman You may choose from using any of these two answers [Change git configuration](http://stackoverflow.com/a/1967986/1511861) or [Convert your line endings with an external tool](http://stackoverflow.com/a/15471083/1511861) – macareno.marco Sep 23 '15 at 17:45
  • @RiyanZaman Are you still getting the fatal: LF would be replaced ... error? – macareno.marco Sep 23 '15 at 18:33
1

They way I fixed is was by adding autocrlf = input , safecrlf = false on the git.config file

Thanks for trying to help @ macareno.marco