rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.92k stars 302 forks source link

Unable to perform initial commit - Configuration value 'user.name' is missing or invalid #2311

Closed jg-repos closed 8 years ago

jg-repos commented 8 years ago

I come across this error when attempting to Initialize New Repository. I've set up user name, email and default repository location using RD's Source Control Settings, and confirmed it was amended to SourceControl.rubberduck <?xml version="1.0" encoding="utf-8"?> <Configuration> <SourceControlSettings> <UserName>mrbub</UserName> <EmailAddress>user@domain.com</EmailAddress> <DefaultRepositoryLocation>C:\gitRepo</DefaultRepositoryLocation> <Repositories /> <CommandPromptLocation>cmd.exe</CommandPromptLocation> </SourceControlSettings> </Configuration>

The Log shows this 2016-10-12 10:58:30.5846;TRACE;Rubberduck.UI.SourceControl.SourceControlViewViewModel;Displaying Info with title 'Settings updated' and message 'Your user name, email address, and default repository location have been saved.'; 2016-10-12 10:59:24.2756;TRACE;Rubberduck.UI.SourceControl.SourceControlViewViewModel;Initializing repo; 2016-10-12 10:59:24.5056;TRACE;Rubberduck.UI.SourceControl.SourceControlViewViewModel;Displaying Error with title 'Unable to perform initial commit.' and message 'Configuration value 'user.name' is missing or invalid.';`

I tried creating a .gitignore, shown below, in the default repository location, but I receive the same error [user] name = mrbub email = user@domain.com

I'm unsure how far Source Control gets before erring out, but the repo is created in the default repository location under the workbook VBA project name. However, I get the following Fatal Error when trying to Open Existing Repo 016-10-12 11:21:24.5579;TRACE;Rubberduck.UI.SourceControl.SourceControlViewViewModel;Opening existing repo; 2016-10-12 11:21:24.5789;TRACE;Rubberduck.UI.SourceControl.SourceControlViewViewModel;Provider changed; 2016-10-12 11:21:24.5939;TRACE;Rubberduck.UI.SourceControl.SourceControlViewViewModel;Displaying Error with title 'No branches found' and message 'Repository does not contain any branches.'; 2016-10-12 11:21:24.5989;TRACE;Rubberduck.UI.SourceControl.SourceControlViewViewModel;Displaying Error with title 'An unknown error occurred.' and message 'Please set your log level to Fatal or lower and create an issue on our GitHub page with the contents of your log file in C:\Users\{username}\AppData\Roaming\Rubberduck\Logs.'; 2016-10-12 11:21:24.5989;ERROR;Rubberduck.UI.SourceControl.SourceControlViewViewModel;System.NullReferenceException: Object reference not set to an instance of an object. at Rubberduck.UI.SourceControl.SourceControlViewViewModel.set_Provider(ISourceControlProvider value) in c:\Users\Mathieu\Documents\GitHub\Rubberduck\RetailCoder.VBE\UI\SourceControl\SourceControlViewViewModel.cs:line 229 at Rubberduck.UI.SourceControl.SourceControlViewViewModel.OpenRepo() in c:\Users\Mathieu\Documents\GitHub\Rubberduck\RetailCoder.VBE\UI\SourceControl\SourceControlViewViewModel.cs:line 721 at Rubberduck.UI.SourceControl.SourceControlViewViewModel.<.ctor>b__2(Object _) in c:\Users\Mathieu\Documents\GitHub\Rubberduck\RetailCoder.VBE\UI\SourceControl\SourceControlViewViewModel.cs:line 69 at Rubberduck.UI.Command.DelegateCommand.ExecuteImpl(Object parameter) in c:\Users\Mathieu\Documents\GitHub\Rubberduck\RetailCoder.VBE\UI\Command\DelegateCommand.cs:line 26 at Rubberduck.UI.Command.CommandBase.Execute(Object parameter) in c:\Users\Mathieu\Documents\GitHub\Rubberduck\RetailCoder.VBE\UI\Command\CommandBase.cs:line 60;

I understand that I'm receiving the second error because Source Control is unable to commit to or create master branch from the initial repository creation, but I can't figure out why I'm getting this first error.

Have I missed anything else during setup?

retailcoder commented 8 years ago

The NRE is thrown here:

if (_fileSystemWatcher.Path != LocalDirectory && Directory.Exists(_provider.CurrentRepository.LocalLocation))

Not sure why a NRE would be thrown there, that looks like a fun bug.

Just to confirm, there was an ActiveVBProject in the IDE, right?

retailcoder commented 8 years ago

There's a page burried in the wiki (I just modified the wiki side bar to include a link to it):

Source Control: Getting Started

I remember having a bit of a hard time with the initial commit myself when I tried the feature, I ended up getting it to work, and documented the steps on that wiki page. Let me know if that works for you.

jg-repos commented 8 years ago

ActiveVBProject.Name does correspond to the correct VBA Project, but I found out what was causing my issue.

I installed Windows Git before installing Rubber Duck, but never actually configured Git. Once I configured Git through cmd git --global --user.name "mrbub" git --global --user.email "user@domain.com"

Source Control completed without error. I don't have a whole lot of experience with Git in general - let alone LibGit2Sharp library - but could Source Control Settings be of lesser priority than Git configuration if Git is installed?

retailcoder commented 8 years ago

@mrbub that would be an interesting feature indeed. Glad you got it to work!