0

i have a little problem using gitgui for a Visual Studio project... there is a .gitignore file in the original Repository to exclude temporary files / the obj folder.

I tried cloning (Full Repository Clone) to my Home Folder from a network drive (Server Drive) - changed something. Tried to Commit it - it still commits the obj folder, i tried deleting the obj folder and get the error:

Pushing to I:/VPR/GIT/BrainFAQ_V3 To I:/VPR/GIT/BrainFAQ_V3 ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'I:/VPR/GIT/BrainFAQ_V3' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Maybe anyone can help me how to fix this.

Kurious
  • 3
  • 1
  • 2
    What does this have to do with C#? – UnholySheep Aug 24 '17 at 07:35
  • Have you _tried_ `git pull ...` ? The nice thing about git is that it actually tries to help you ... – Fildor Aug 24 '17 at 07:38
  • well it's a C# Project and it has to do with the obj folder from Visual-Studio. – Kurious Aug 24 '17 at 07:39
  • Has the .gitignore file been pulled? Is it actually working on a different system? At a coworker's for example? – Fildor Aug 24 '17 at 07:40
  • @Fildor it didnt pull the .gitignore file - it's not working at any different system – Kurious Aug 24 '17 at 07:41
  • "well it's a C# Project" - And that's about it with C#. The problem has nothing to do with C# - it could be any project structure regardless the language. – Fildor Aug 24 '17 at 07:41
  • "it didnt pull the .gitignore file - it's not working at any different system" - why do you expect the obj folder to _not_ being pushed then? But actually , those are two different problems I guess. I'd recommend setting up a dummy project to play around with and figure out how git works, first. – Fildor Aug 24 '17 at 07:42
  • It is producing conflicts with the obj folder cause the files in there are temporary linked to the user. And it always will have the issue that "current project is behind" – Kurious Aug 24 '17 at 07:44
  • That's why you need to set it on ignore. But you need to do that in your local repo, too. How would git know the obj folder shall be ignored? – Fildor Aug 24 '17 at 07:46
  • Please see: https://git-scm.com/docs/gitignore – Fildor Aug 24 '17 at 07:49

1 Answers1

0

Follow below steps

  1. Connect Visual Studio with Git Server
  2. Clone in Local folder of your system
  3. Open the solution that just got retrieved from Git Server to your local system
  4. Do the changes and build the application.
  5. Delete the folder you do not want to commit in Git from Visual studio, your .sln file of project will get changed accordingly or can use .gitignore and specify the files that you do not commit to Git Server. For More refer https://help.github.com/articles/ignoring-files/
  6. Now, commit and push the changes to Git Server
  7. Step 6 will be success only if there is not commit happened on master branch from the time you cloned the application.
Lara
  • 2,821
  • 7
  • 39
  • 72
  • @Kurious Glad to know that, however surprised to see downvoted accepted answer:) Dont know why its downvoted!! – Lara Aug 24 '17 at 09:31
  • 1
    I _guess_ **it's** because of point #5. If you want git to ignore something, tell it so. That's what gitignore is for. Always deleting something before commit is very cumbersome and in the end - it could be forgotten some time. Not a very stable solution. More like a "workaround". At least that would have been my reason. Can't speak for the dv, though. – Fildor Aug 24 '17 at 11:26