[英]Git (SSH) in Visual Studio 2015
So with Visual Studio 2015 just being released there is a much more integrated tie-in with git. 因此,随着Visual Studio 2015刚刚发布,与git的集成更加紧密。
However the feature that seems to be lacking is git over SSH. 然而,似乎缺乏的功能是通过SSH的git。 There are various plugins for 2013 that allow this functionality (ie GitExtensions) but I can't see any with 2015.
2013年有各种插件允许此功能(即GitExtensions)但我在2015年看不到任何插件。
GitHub plugin only appears to work with GitHub and not generic git repos. GitHub插件似乎只适用于GitHub而不是通用的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. 我不是在寻找一个更好的观点,只有一些例子或文章,看看是否有人在Visual Studio 2015上运行Git + SSH。
No. Visual Studio 2015 (RTM) does not support SSH for Git remotes. 没有.Visual Studio 2015(RTM)不支持用于Git遥控器的SSH。 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.)
即使GitHub存储库使用GitHub插件(目前使用与Git存储库相同的连接机制,使用团队资源管理器,也是如此)。
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. 这是令人遗憾的,但是有一些原因导致这种情况尚不可用:简而言之,我们认为,提供SSH 不良或不安全比完全不提供SSH更糟糕,我们希望非常有信心我们提供的任何SSH实现都是高质量的。
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).
微软将开始在Windows中包含OpenSSH (并且是该非常精细项目的赞助商)。 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. GitHub扩展是开源的,因此它可能能够使用不同的连接机制并在团队资源管理器中的核心Git支持之前开始支持SSH。
Here's some basic instructions for Visual Studio Update 2 and Update 3. See the link in BPas' post for the basic stuff, eg you'll need: 以下是Visual Studio Update 2和Update 3的一些基本说明。请参阅BPas帖子中的基本内容链接,例如,您需要:
Build libssh2 构建libssh2
Do the following: 请执行下列操作:
cd <libssh2 root dir> (eg 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 在构建目录中打开生成的libssh2.sln
Build libgit2 构建libgit2
Do the following: 请执行下列操作:
cd <libgit2 source dir> (eg 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 在构建目录中打开生成的libgit2.sln
Optional: Patch src/transports/ssh.c to support SSH RSA key authentication, in function request_creds (around line 444): 可选:修补src / transports / ssh.c以支持SSH RSA密钥身份验证,在函数request_creds中(第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. 注意:这个补丁是从randomswdev帖子中的评论中抓取的,似乎在我的有限测试中工作正常。
Conforming to BPas: for Visual Studio 2015 it is possible to build SSH enabled version. 符合BPas:对于Visual Studio 2015,可以构建启用SSH的版本。 Moreover, i have patch for public/private key auth support:
此外,我有公共/私人密钥auth支持补丁:
https://github.com/PROGrand/git2-msvstfs-ssh-patch https://github.com/PROGrand/git2-msvstfs-ssh-patch
It is possible to enable ssh support by recompiling the GIT library distributed with Visual Studio 2015. The following article describes the required steps: 可以通过重新编译随Visual Studio 2015分发的GIT库来启用ssh支持。以下文章介绍了所需的步骤:
http://randomswdev.blogspot.it/2015/07/adding-ssh-support-to-visual-studio.html http://randomswdev.blogspot.it/2015/07/adding-ssh-support-to-visual-studio.html
There used to be nonsense here about adding your git to visual studio using the git bash. 这里曾经有过废话,关于使用git bash将你的git添加到visual studio中。 Even though adding would work, creating commits was also an option but syncing them would still require the git bash.
即使添加可行,创建提交也是一种选择,但同步它们仍然需要git bash。 So this would be kinda useless.
所以这有点无用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.