在拇指驱动器上克隆 git 存储库
我已经在 /applications/mamp/htdocs/myproject/.git 中有一个本地工作空间存储库,但我不知道如何将其克隆到我的拇指驱动器中的文件夹中并将其用作我的遥控器来推送。
我是否必须首先在我的文件夹的目录中创建一个裸 git 存储库?然后将我的工作空间克隆到其中之一?
或者我是否只需 cd 到拇指驱动器上的目录(没有 .git 目录)并将工作空间存储库克隆到其中,这将自动在拇指驱动器上创建 .git 存储库?
我对使用拇指驱动器作为远程存储库的正确步骤感到困惑,
我的拇指驱动器的路径是“volumes/thumbdrive/”,
现在我正在尝试添加我的遥控器,但我猜我似乎无法获得正确的路径。 。
David-Adamss-MacBook-Pro:myproject davidadams$ git remote add flashstick /volumes/thumbdrive/repo/.git
David-Adamss-MacBook-Pro:myproject davidadams$ git remote
flashstick
thumdrive
David-Adamss-MacBook-Pro:myproject davidadams$ git push flashstick master
fatal: '/volumes/thumbdrive/repo/.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
这也不起作用
David-Adamss-MacBook-Pro:myproject davidadams$ git remote add flashdrive /volumes/thumbdrive/repo
David-Adamss-MacBook-Pro:myproject davidadams$ git remote
flashdrive
flashstick
thumdrive
David-Adamss-MacBook-Pro:myproject davidadams$ git push flashdrive master
fatal: '/volumes/thumbdrive/repo' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
David-Adamss-MacBook-Pro:myproject davidadams$
I already have a local workig space repository in /applications/mamp/htdocs/myproject/.git and i can't figure out how to clone it onto a folder in my thumbdrive and use that as my remote to push to.
do i have to create a bare git repository in the directory on my folder first? and then clone my working space one to it?
or do i just cd into my directory on my thumbdrive(with no .git directory) and clone the working space repo to it which would automatically create the .git repo on the thumbdrive?
i'm confused on the proper steps to use my thumbdrive as my remote repo
my thumbdrive's path is "volumes/thumbdrive/"
now i'm trying to add my remote but i can't seem to get the path right i guess...
David-Adamss-MacBook-Pro:myproject davidadams$ git remote add flashstick /volumes/thumbdrive/repo/.git
David-Adamss-MacBook-Pro:myproject davidadams$ git remote
flashstick
thumdrive
David-Adamss-MacBook-Pro:myproject davidadams$ git push flashstick master
fatal: '/volumes/thumbdrive/repo/.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
and this didn't work either
David-Adamss-MacBook-Pro:myproject davidadams$ git remote add flashdrive /volumes/thumbdrive/repo
David-Adamss-MacBook-Pro:myproject davidadams$ git remote
flashdrive
flashstick
thumdrive
David-Adamss-MacBook-Pro:myproject davidadams$ git push flashdrive master
fatal: '/volumes/thumbdrive/repo' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
David-Adamss-MacBook-Pro:myproject davidadams$
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将本地存储库克隆到您的
volumes/thumbdrive
中,然后从旧的存储库设置到这个新克隆的存储库的遥控器。上面后面的远程名称将是
thumbdrive
(如果需要,请使用 origin 一样推送),您可以像另一种方法
:将
/applications/mamp/htdocs/myproject/.git
复制/移动到拇指驱动器,然后将其克隆回所需位置。Clone the local repository into your
volumes/thumbdrive
and then setup remotes to this newly cloned repo from the old oneThe remote name after above would be
thumbdrive
( use origin if you want ) and you can push likeAnother approach:
Copy / move
/applications/mamp/htdocs/myproject/.git
to the thumbdrive and then clone it back to the desired location.执行此操作的最佳方法是 cd 到 /volumes/thumbdrive/repo 目录,然后:
这将克隆存储库,但不会在拇指驱动器上创建任何工作副本。如果您查看遥控器,您将看到创建了一个名为 myproject.git 的目录,这可能就是您想要的。
然后从本地 git 存储库:
进行更改后,您可以:
The best way to do this is to cd to /volumes/thumbdrive/repo directory and then:
This will clone the repo, but won't make any working copies on the thumbdrive. If you look at the remote, you'll see one directory created, called myproject.git, which is probably what you want.
Then from your local git repo:
After you make changes, you can:
转到
volumes/thumbdrive/
,然后:从那时起,您可以将
push
内容推送到volumes/thumbdrive
,或者从拉取/应用程序
Go to
volumes/thumbdrive/
, then:From then on, you can just
push
things tovolumes/thumbdrive
, or pull from/applications