git Gitkraken 与 SSH 到 Gitlab
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39415319/
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
Gitkraken with SSH to Gitlab
提问by Diogo Mendon?a
I've been having a hard time getting the auth to work with ssh keys (don't want to be prompted for user and pass every time). Configuration options / tutorials for this issue are scarce/nonexistant.
我一直很难让 auth 使用 ssh 密钥(不想每次都提示输入用户并通过)。此问题的配置选项/教程很少/不存在。
Here is the setup:
这是设置:
I believe the repo from Gitlab was added with https, can't find a way to change this, don't know if it's important.
I'm running Windows 10 with git-bash and have followed the tutorial on Github to generate the keys and add them to the ssh-agent. Added the public one to my gitlab profile and can "ssh -T [email protected]" successfully.
- Have messed around with the profile inside .gitkraken and changed the paths for the ssh keys to: "useLocalAgent": true, "privateKey": "C:\Users\mendo\.ssh\id_rsa", "publicKey": "C:\Users\mendo\.ssh\id_rsa.pub".
- When I do a pull I'm always prompted to insert the username and pass (even though I started the ssh-agent process from the git-bash).
我相信来自 Gitlab 的 repo 是用 https 添加的,找不到改变它的方法,不知道它是否重要。
我正在使用 git-bash 运行 Windows 10,并按照 Github 上的教程生成密钥并将它们添加到 ssh-agent。将公共的添加到我的 gitlab 配置文件中,并且可以成功“ssh -T [email protected]”。
- 弄乱了 .gitkraken 中的配置文件并将 ssh 密钥的路径更改为:"useLocalAgent": true, "privateKey": "C:\Users\mendo\.ssh\id_rsa", "publicKey": "C: \Users\mendo\.ssh\id_rsa.pub”。
- 当我执行 pull 时,总是提示我插入用户名并通过(即使我从 git-bash 启动了 ssh-agent 进程)。
Don't know how I can solve this so any help you guys can provide will be much appreciated. Also, can't find a single way in app or online to remove/delete a repository from the app (I hope it's not obvious and I'm making a fool of myself).
不知道我该如何解决这个问题,所以你们能提供的任何帮助将不胜感激。此外,无法在应用程序或在线找到从应用程序中删除/删除存储库的单一方法(我希望这不是显而易见的,而且我在自欺欺人)。
Thanks in advance for your help!
在此先感谢您的帮助!
Best, Diogo
最好的,迪奥戈
回答by Marcello Nicoletti
If the repo was cloned with HTTPS then no changes to SSH settings will work. You will first have to change the URL for your remote. Luckily you can do this inside GitKraken.
如果 repo 是使用 HTTPS 克隆的,则对 SSH 设置的任何更改都不会起作用。您首先必须更改遥控器的 URL。幸运的是,您可以在 GitKraken 中执行此操作。
First you should navigate to your repo in GitKraken.
首先,您应该导航到 GitKraken 中的存储库。
- In the left panel expand the remote group (represented by a cloud). This panel may be hidden, if so you'll need to click the right facing arrow symbol that should appear under the folder icon in the top left.
- 在左侧面板中展开远程组(由云表示)。此面板可能是隐藏的,如果是这样,您需要单击应出现在左上角文件夹图标下的向右箭头符号。
- With the remote group expanded you should see a source called Origin. Hovering over this item reveals a vertical "...", that is the options button.
- 随着远程组的展开,您应该会看到一个名为 Origin 的源。将鼠标悬停在此项目上会显示一个垂直的“...”,即选项按钮。
- Click options and select "Edit Origin". This will open a sub-window that that will have two text boxes you can edit. The push and pull urls. switch these from
https://gitlab.com/user/repo.git
to[email protected]:user/repo.git
- 单击选项并选择“编辑原点”。这将打开一个子窗口,其中有两个可以编辑的文本框。推和拉网址。将这些从 切换
https://gitlab.com/user/repo.git
到[email protected]:user/repo.git
Once these steps are done then you can start changing GitKraken's ssh settings. In Windows if you aren't using Pagent (from PuTTY) then you shouldn't select "use local agent" in GitKraken. Without Pagent you can only use one key at a time and change the settings when you need to change keys.
完成这些步骤后,您就可以开始更改 GitKraken 的 ssh 设置。在 Windows 中,如果您不使用 Pagent(来自 PuTTY),则不应在 GitKraken 中选择“使用本地代理”。如果没有 Pagent,您一次只能使用一个键,并在需要更改键时更改设置。
If you wanted to use the command line to change the URL you can run the git-bash equivalent to git remote set-url [email protected]:user/repo.git
from within the repo's root directory.
如果您想使用命令行来更改 URL,您可以git remote set-url [email protected]:user/repo.git
在 repo 的根目录中运行等效于的 git-bash 。
PS: Sorry that I can't embed images directly into my answer, not enough karma for that yet. Same for extra links.
PS:抱歉,我无法将图像直接嵌入到我的答案中,还没有足够的业力。额外链接也一样。
回答by Ajay P. Prajapati
Try adding this to your git bash :
尝试将其添加到您的 git bash 中:
git config --global user.name="yourUserName"
git config --global user.email="[email protected]"