Skip to content

Commit

Permalink
Version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MircoBabin committed Sep 11, 2020
0 parents commit 3b57023
Show file tree
Hide file tree
Showing 17 changed files with 600 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/bin
/obj
/.vs
src/bin
src/obj
src/.vs
src/git-credential-keepasscommand/bin
src/git-credential-keepasscommand/obj
src/git-credential-keepasscommand/.vs
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Git Credentials via KeePassCommander contributions

All contributions are accepted under [the MIT license](LICENSE.md "license").

## Rules

For each contribution the following rules apply:

1. The contribution must provide something meaningful to the end user, who is running git-credential-keepasscommand.exe
* Internal refactorings will not be accepted. They are not meaningful to the end user.
* Internal reorganisation of the files/maps structure will not be accepted. It is not meaningful to the end user.
* Adding a Dependency Injection framework like Autofac will not be accepted. It is not meaningful to the end user.
* Unit Tests / Tests may be accepted. Each contributed test will be examined seperatly.

2. Only the Microsoft Windows platform will be supported.
* Contributions regarding another OS like Linux/MacOS will not be accepted.

3. Only the .NET framework 4 will be supported.
* Contributions regarding another .NET framework like .NET core will not be accepted.

4. Only the WinForms GUI framework will be supported.
* Contributions regarding another GUI framework like XAML will not be accepted.

5. The project should compile out of the box, without additional download.
* After cloning this project to a local harddisk, no additional downloads must be necessary. The project must compile at once.
* NuGet packages download are forbidden.
* NuGet packages are not forbidden, as long as they are inside the project and not downloaded.

**If one or more of these rules violates the principles/preferences of a person, that person is adviced to fork this project. And change the fork to his/her preferences.**
25 changes: 25 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Git Credentials via KeePassCommander
## MIT license

Copyright (c) 2020 Mirco Babin

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Git Credentials via KeePassCommander
It's purpose is to retrieve username/password credentials for GIT from [KeePass password store](https://keepass.info/ "KeePass") using plugin [KeePassCommander](https://github.com/MircoBabin/KeePassCommander "KeePassCommander").

# Download binary
For Windows (.NET framework 4), [the latest version can be found here](https://github.com/MircoBabin/GitCredentialsViaKeePassCommander/releases/latest "Lastest Version").

Download the zip and unpack it in the KeePassCommander directory where KeePassCommandDll.dll is located.

The minimum .NET framework required is 4.0.

# Help

Execute **git-credential-keepasscommand.exe** without parameters to view the help.

```
git-credential-keepasscommand 1.0
https://github.com/MircoBabin/GitCredentialsViaKeePassCommander - MIT license
git-credential-keepasscommand.exe is a credential helper for GIT.
It's purpose is to retrieve username/password credentials for GIT from KeePass using plugin KeePassCommander.
INSTALLATION:
*** Place executable and config in same directory as KeePassCommandDll.dll
*** See KeePassCommander at https://github.com/MircoBabin/KeePassCommander
git config --global credential.helper "D:/Projects/GitCredentialsViaKeePassCommander/bin/Release/git-credential-keepasscommand.exe"
git config --system --list --show-origin
if there still is a credential.helper=manager listed, remove that
e.g. from C:/Program Files/Git/mingw64/etc/gitconfig remove [credential] helper=manager
UNINSTALL:
git config --global credential.helper manager
KeePass ENTRY:
In KeePass an entry containing username and password should be present with the following case-sensitive title (without quotes): "git [...lowercase last part of directoryname...]".
e.g. the rootdirectory of the GIT project is d:\projects\GitCredentialsViaKeePassCommander, then the KeePass title is exactly "git [gitcredentialsviakeepasscommander]
```

# Installation in GIT

* Open a dosprompt
* Execute git-credential-keepasscommand.exe without parameters and follow the installation instructions. (This will show the correct path for configuring GIT.)
* Remove "git:..." credentials from the Windows Credential Manager, found in the Windows Control Panel. (In Dutch "Windows Referentiebeheer te vinden in het Configuratiescherm".)

# Entries in KeePass

Each project (GIT rootdirectory) must have an entry in KeePass. The title of the entry should be ```git [...lowercase last part of directoryname...]```. And the entry should contain the username and password to login.

E.g. the root of the GIT project is d:\projects\webpage\myportals (containing the subdirectory .git) then the title of the entry is ```git [myportals]```.

![ScreenshotEntries](screenshotentries.png)

# Limitations

* 2-factor authentication is not supported.
* HTTPS transport works. SSH transport is not tested.
* It works with Bitbucket and Github. Other providers are not tested.

# Why
The default git credential "manager" stores passwords in the Windows Credential Manager. I don't want passwords to be stored in Windows, I want all my passwords stored in KeePass.

So I build git-credential-keepasscommand.exe which uses KeePassCommander to retrieve credentials from KeePass.

# Contributions
Contributions are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md "contributing") before making any contribution!

# License
[The license is MIT.](LICENSE.md "license")





Binary file added assets/KeePassCommandDll.dll
Binary file not shown.
Binary file added assets/Release_1.0-debugpack.zip
Binary file not shown.
Binary file added assets/Release_1.0.zip
Binary file not shown.
4 changes: 4 additions & 0 deletions assets/copy-KeePassCommandDll.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
cd /d "%~dp0"
del /q KeePassCommandDll.dll >nul 2>&1
copy /y ..\..\KeePassCommander\bin\release\KeePassCommandDll.dll
Binary file added screenshotentries.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions src/GitCredentialsViaKeePassCommander.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "git-credential-keepasscommand", "git-credential-keepasscommand\git-credential-keepasscommand.csproj", "{6D04E687-F9E8-4B33-A7DA-DC342B5B8B6E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{135942C9-DB5F-499E-9A93-BDA430E769CD}"
ProjectSection(SolutionItems) = preProject
GlobalAssemblyInfo.cs = GlobalAssemblyInfo.cs
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6D04E687-F9E8-4B33-A7DA-DC342B5B8B6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D04E687-F9E8-4B33-A7DA-DC342B5B8B6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D04E687-F9E8-4B33-A7DA-DC342B5B8B6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D04E687-F9E8-4B33-A7DA-DC342B5B8B6E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
16 changes: 16 additions & 0 deletions src/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
12 changes: 12 additions & 0 deletions src/common.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir>
<Configuration Condition="$(Configuration) == ''">Debug</Configuration>
<OutputPath>$(SolutionDir)\..\bin\$(Configuration)\</OutputPath>
<OutDir>$(OutputPath)</OutDir>
<IntermediateOutputPath>$(SolutionDir)\..\bin\obj\$(Configuration)\$(MSBuildProjectName)\</IntermediateOutputPath>
<UseCommonOutputDirectory>False</UseCommonOutputDirectory>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
</Project>
6 changes: 6 additions & 0 deletions src/git-credential-keepasscommand/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>
</configuration>
19 changes: 19 additions & 0 deletions src/git-credential-keepasscommand/NameValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace git_credential_keepasscommand
{
public class NameValue
{
public string Name { get; set; }
public string Value { get; set; }

public NameValue(string Name, string Value)
{
this.Name = Name;
this.Value = Value;
}
}
}
Loading

0 comments on commit 3b57023

Please sign in to comment.