Reputation: 9752
So with Visual Studio 2015 just being released there is a much more integrated tie-in with git.
However the feature that seems to be lacking is git over SSH. There are various plugins for 2013 that allow this functionality (i.e GitExtensions) but I can't see any with 2015.
GitHub plugin only appears to work with GitHub and not generic git repos.
I'm not looking for an opinion of which is better, only some examples or articles to see if anyone has got Git+SSH on Visual Studio 2015 working.
Upvotes: 44
Views: 29864
Reputation: 71
Here's some basic instructions for Visual Studio Update 2 and Update 3. See the link in BPas' post for the basic stuff, e.g. you'll need:
Build libssh2
Do the following:
cd <libssh2 root dir> (e.g. wherever you extracted the source to)
mkdir build && cd build
cmake -DCRYPTO_BACKEND=WinCNG -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF ..
Open the resulting libssh2.sln in the build directory
Build libgit2
Do the following:
cd <libgit2 source dir> (e.g. this is wherever you extracted the libgit2 source you got from VS2015's extensions directory, see BPas' link for details)
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DSTDCALL=ON -DSTATIC_CRT=OFF -DUSE_SSH=OFF -DLIBSSH2_FOUND=TRUE -DLIBSSH2_INCLUDE_DIRS=<libssh2 root dir>/include -DLIBSSH2_LIBRARIES=<libssh2 root dir>/build/src/Release/libssh2.lib ..
Open the resulting libgit2.sln in the build directory
Optional: Patch src/transports/ssh.c to support SSH RSA key authentication, in function request_creds (around line 444):
if (!t->owner->cred_acquire_cb) {
no_callback = 1;
} else {
with:
if (!t->owner->cred_acquire_cb) {
if (user) {
const char *val = NULL;
val = getenv("USERPROFILE");
if (val)
{
char *szprivfilename = malloc(strlen(val) + 128);
char *szpubfilename = malloc(strlen(val) + 128);
strcpy(szprivfilename, val);
strcat(szprivfilename, "/.ssh/id_rsa");
strcpy(szpubfilename, val);
strcat(szpubfilename, "/.ssh/id_rsa.pub");
git_cred_ssh_key_new(&cred, user, szpubfilename, szprivfilename, "");
free(szprivfilename);
free(szpubfilename);
}
if (!cred) {
giterr_set(GITERR_SSH, "git_cred_ssh_key_new failed to initialize SSH credentials");
return -1;
}
}
else
{
no_callback = 1;
}
} else {
Note: this patch was grabbed from one the comments in randomswdev's post, seems to work fine from my limited testing.
Upvotes: 7
Reputation:
There used to be nonsense here about adding your git to visual studio using the git bash. Even though adding would work, creating commits was also an option but syncing them would still require the git bash. So this would be kinda useless.
Upvotes: 0
Reputation: 668
Conforming to BPas: for Visual Studio 2015 it is possible to build SSH enabled version. Moreover, i have patch for public/private key auth support:
https://github.com/PROGrand/git2-msvstfs-ssh-patch
Upvotes: 4
Reputation: 99
It is possible to enable ssh support by recompiling the GIT library distributed with Visual Studio 2015. The following article describes the required steps:
http://randomswdev.blogspot.it/2015/07/adding-ssh-support-to-visual-studio.html
Upvotes: 3
Reputation: 78653
No. Visual Studio 2015 (RTM) does not support SSH for Git remotes. This is true even with GitHub repositories using the GitHub plug-in (which - at present - uses the same connection mechanism for Git repositories as any other Git repository using Team Explorer.)
This is regrettable, but there are a handful of reasons why this is not available yet: the short answer is that in our opinion, providing SSH poorly or insecurely is worse than not providing SSH at all, and we would like to be very confident that any SSH implementation we provide is of high-quality.
That said, we are working on it, and making progress. Microsoft is going to begin including OpenSSH in Windows (and is a sponsor of that very fine project). However I cannot make any predictions as to when support might be available.
The GitHub extension is open source, so it's possible that it may be able to use a different connection mechanism and begin supporting SSH before the core Git support in Team Explorer.
Upvotes: 49