简体   繁体   English

在本地克隆 Git 存储库

[英]Cloning Git repository locally

I have just create a git repository on my iMac under the user git account and am now want to clone it from my main user account on the same computer.我刚刚在用户 git 帐户下在我的 iMac 上创建了一个 git 存储库,现在我想从同一台计算机上的主用户帐户克隆它。 I have created my SSH key and added it to the.ssh/authorized_keys file.我已经创建了我的 SSH 密钥并将其添加到 .ssh/authorized_keys 文件中。 However when I log back in with my main account I get the following error message:但是,当我使用我的主帐户重新登录时,我收到以下错误消息:

Permission denied (publickey) fatal: The remote end hung up unexpectedly Permission denied (publickey) fatal: 远端意外挂断

Now to me, and while searching on the web it seems like my public key is incorrect.现在对我来说,在搜索 web 时,我的公钥似乎不正确。 I have created it twice and still get the same issue.我已经创建了两次,但仍然遇到同样的问题。

You shouldn't need an ssh key at all. 您根本不需要ssh密钥。 Make all of the files world readable and just clone the full path. 使所有文件对世界都可读,并仅克隆完整路径。 In other words, do 换句话说,做

$ git clone /path/to/repo
git clone /path/to_repository  /path/to_where_you_want_it_cloned

确保您的主要用户帐户具有复制到帐户目录或从帐户目录复制的权限。

One additional point is that if you created the git repo and did a git init -bare , you use a.git extension, but you do not need this on the folder name (when cloning it on the same machine).还有一点是,如果您创建了 git 存储库并执行了git init -bare ,您将使用 .git 扩展名,但您不需要在文件夹名称上使用它(在同一台机器上克隆它时)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM