git MAC 上的 GitBash
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18177169/
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
GitBash on the MAC
提问by Simon Davies
I am trying to follow Set up SSH for Gi. it goes on about opening GitBash but is this something else to terminal? As i follow this within the mac terminal and i get most of it but the ending as it does not work so i think its GitBash i need and not terminal so where can i find this on the mac?
我正在尝试为 Gi 设置 SSH。它继续打开 GitBash,但这是终端的其他东西吗?当我在 mac 终端中执行此操作时,我得到了大部分内容,但由于它不起作用,所以我认为它是我需要的 GitBash 而不是终端,所以我可以在 mac 上的哪里找到它?
I get as far as step 5 then section 6 where when i reopen gitbash i should get the passphrase question etc but nothing and when i list identities ssh-add -l i get nothing.
我到了第 5 步,然后是第 6 节,当我重新打开 gitbash 时,我应该得到密码短语问题等,但什么也没有,当我列出身份时 ssh-add -li 什么也得不到。
回答by Simon Davies
Edit
编辑
I was finally able to bring up the webpage at Set up SSH for Git. At the top of the page, you'll see a big green notice boxwith this message (emphasis mine):
我终于能够在Set up SSH for Git 中打开网页。在页面顶部,您会看到一个带有此消息的大绿色通知框(重点是我的):
Linux or Mac User?
This page shows you how to set up and use a single default SSH identity on Windows for a Git repository using GitBash. In the next page, you set up SSH for a Mercurial repository on Windows with TortoiseHg. If you are working on Mac OSX or Linux, a single set of instructions shows you how to setup and identity for either Git or Mercurialin these environments.
Linux 或 Mac 用户?
此页面向您展示如何使用 GitBash 在 Windows 上为 Git 存储库设置和使用单个默认 SSH 身份。在下一页中,您将使用 TortoiseHg 在 Windows 上为 Mercurial 存储库设置 SSH。如果您在 Mac OSX 或 Linux 上工作,一组说明将向您展示如何在这些环境中为 Git 或 Mercurial 设置和标识。
Since you're using a Mac, you should see if the instructions at the given help link solve your problems. To be clear, here is the link again:
由于您使用的是 Mac,您应该查看给定帮助链接中的说明是否能解决您的问题。为了清楚起见,这里是链接:
If it helps, here is a screenshot of the original notice box too:
如果有帮助,这里也是原始通知框的屏幕截图:
Old answer (still has useful info for running ssh-agent manually though)
旧答案(尽管仍然有用于手动运行 ssh-agent 的有用信息)
I can't read your link right now because my browser won't open the page, but from your description, it sounds like you're trying to get ssh-agent
to start automatically whenever you open up a terminal. Do you have ssh-agent
already installed and in your path?
我现在无法阅读您的链接,因为我的浏览器无法打开该页面,但从您的描述来看,您似乎在尝试ssh-agent
在打开终端时自动启动。您是否ssh-agent
已经安装并在您的路径中?
You don't need to configure ssh-agent
to run automatically, you can just invoke it manually. Try
您不需要配置ssh-agent
为自动运行,您只需手动调用它即可。尝试
eval `ssh-agent -s`
Then run ssh-add
to enter your passphrase for your private key. Be sure to shutoff ssh-agent
when you're done using ssh-agent -k
.
然后运行ssh-add
以输入您的私钥的密码。一定要关闭ssh-agent
,当你使用完成ssh-agent -k
。
回答by alairock
Atlassian has an AMAZING resource for GIT. If you are new to git, I would highly recommend using their GIT GUI, SourceTree
Atlassian 有一个惊人的 GIT 资源。如果您不熟悉git,我强烈建议您使用他们的 GIT GUI SourceTree
SourceTree should automatically setup GIT on your machine, and manage your repo right from the application.
SourceTree 应该会自动在您的机器上设置 GIT,并直接从应用程序管理您的存储库。
Then you can just use the following command to see if you have git installed:
然后你可以使用以下命令查看是否安装了git:
$ which git
If it doesn't come back empty, you have it installed. But at this point, you can do everything in SourceTree. No need to do it via command line.
如果它没有返回为空,则您已安装它。但此时,您可以在 SourceTree 中完成所有操作。无需通过命令行执行此操作。