使用 Github for Windows 通过 SSH 使用自己的私有 Git
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11165458/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using Github for Windows to work with own private Git through SSH
提问by Hito_kun
Right now, I'm using msysgit to work with my own private repositories stored on a ec2 Amazon Cloud Server using SSH.
现在,我正在使用 msysgit 来处理我自己的私有存储库,这些存储库使用 SSH 存储在 ec2 Amazon 云服务器上。
Until now, I've been able to successfully connect to those repositories through Git Bash (creating the ssh-rsa public and private key with ssh-keygen, adding the public key to the authorized_servers on the remote machine), so I can clone, push, pull, get through the CLI.
到目前为止,我已经能够通过 Git Bash 成功连接到这些存储库(使用 ssh-keygen 创建 ssh-rsa 公钥和私钥,将公钥添加到远程机器上的 authorized_servers),所以我可以克隆,推,拉,通过 CLI。
Now, I've seen Github for Windows, and I gotta say, it is a beautiful piece of software. Since it is based on msysgit, I was wondering that if it is possible to setup Github for Windows to connect, clone and push commits through the UI?
现在,我已经看到了 Windows 版的 Github,我不得不说,它是一款漂亮的软件。由于它基于 msysgit,我想知道是否可以为 Windows 设置 Github 以通过 UI 连接、克隆和推送提交?
In the description it looks like possible, but the documentation seems to lacks information about what the software is capable to do.
在描述中它看起来可能,但文档似乎缺乏关于软件能够做什么的信息。
Hope you can help me out here, cheers from Mexico.
希望你能在这里帮助我,来自墨西哥的欢呼。
采纳答案by Eswar Rajesh Pinapala
Here is a nice write up of what you are exactly looking for.
这是一篇很好的文章,说明了您正在寻找的内容。
Edit: I just tested with the following steps and it works like charm!!
编辑:我刚刚通过以下步骤进行了测试,它的工作原理非常迷人!!
1. Click on repositories on the left.
2. Pull your copy of the repo from the remote , using git-shell
3. Drag and drop the Folder on to Git hub for windows dashboard.
4. now double click on the repository dropped on to githubW. It should be listed as a local repository.
5. it says login required to your non-github remote!
For some wierd reason, GutHub didn't make it straightforward to use non-GitHub Remotes. (As you said, they say that they support non-github remotesthough!!)
出于某种奇怪的原因,GutHub 并没有让使用非 GitHub Remotes 变得简单。(正如你所说,他们说他们支持非 github 遥控器!!)
回答by Deb
Late answerbut this is how I did it for using Gitlab.com through SSHon Github for windows.
迟到的答案,但这就是我在 Github for Windows 上通过SSH使用 Gitlab.com 的方式。
- Add your public ssh key from github_rsa.pub (which is found in your .ssh folder) to your SSH keys on Gitlab.com
Add a
config
file to your .ssh folder that looks like thisHost gitlab.com RSAAuthentication yes IdentityFile ~/.ssh/github_rsa User mygitlabloginemail
Clone / pull your repository through Git Bash
- Drag the folder to Github For Windows
- 将 github_rsa.pub(位于 .ssh 文件夹中)中的公共 ssh 密钥添加到 Gitlab.com 上的 SSH 密钥
将一个
config
文件添加到您的 .ssh 文件夹中,如下所示Host gitlab.com RSAAuthentication yes IdentityFile ~/.ssh/github_rsa User mygitlabloginemail
通过 Git Bash 克隆/拉取您的存储库
- 将文件夹拖到 Github For Windows
And thats it, you can now use Github for Windows with your gitlab repository.
就是这样,您现在可以将 Github for Windows 与您的 gitlab 存储库一起使用。
回答by VonC
Since GitHub for Windows also work with https url, note that since August 2013, you also can use an OAuth tokens for authentication.
See "Better password security in GitHub for Windows"
由于 GitHub for Windows 也使用 https url,请注意,自 2013 年 8 月起,您还可以使用 OAuth 令牌进行身份验证。
请参阅“ GitHub for Windows 中更好的密码安全性”
Prior to this release the application would encrypt and store your password. Since the application also registers itself as your Git credential provider, the app would provide your credentials in clear text to Git.exe whenever it asked for them.
With this release, when you log in with your username and password, the application registers itself on GitHub.com as an
Authorized application
and receives an OAuth token that it stores instead of your password. This is similar to how other applications that integrate with GitHub work such as Travis-CI.
在此版本之前,应用程序会加密并存储您的密码。由于该应用程序还将自己注册为您的 Git 凭据提供程序,因此该应用程序会在需要时以明文形式向 Git.exe 提供您的凭据。
在此版本中,当您使用您的用户名和密码登录时,应用程序会在 GitHub.com 上将自己注册为
Authorized application
并接收它存储的 OAuth 令牌而不是您的密码。这类似于与 GitHub 集成的其他应用程序的工作方式,例如 Travis-CI。
回答by axel chanfrault
It is pretty wierd but the only solution is to drag and drop the URL of the repository into Github for Windows. It will then ask you for your name and password for the cusom Git (private, Lab or else)... and voilà.
这很奇怪,但唯一的解决方案是将存储库的 URL 拖放到 Github for Windows 中。然后它会要求你输入自定义 Git(私人、实验室或其他)的名称和密码......然后瞧。