使用另一个名称克隆Git存储库

17

如何克隆名为myproject的存储库?

服务器目录使用智能的https命名为一个唯一代码,例如584ffceed.git。 如何设置权限以要求用户名和密码并授予推送或拉取权限?


2
git clone -> https://git-scm.com/docs/git-clone - myselfmiqdad
3个回答

26
要克隆到myproject,只需执行git clone ... / 584ffceed.git myproject
关于您的另一个问题,不太清楚您在问什么。请重新表达问题以使其更清晰。

我该如何让Git在克隆或推送时要求我的http://site.tk的用户名和密码进行身份验证? - shreyansh goel
你说你使用像这里描述的 Smart HTTP:https://git-scm.com/book/be/v2/Git-on-the-Server-Smart-HTTP?该页面还描述了如何添加身份验证。 - Vampire
有没有任何关于如何使用nginx的想法? - shreyansh goel
从未使用过 - Vampire
1
请跟随我给你的链接,它展示了一个例子。除此之外,可以遵循 Apache 的文档,根据实际需求有无数种设置 Apache 认证的方法。 - Vampire
显示剩余2条评论

9
以这种方式克隆存储库:
git clone clone_url.git project_name

8

来自 man git-clone:

   git clone [--template=<template_directory>]
             [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
             [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
             [--dissociate] [--separate-git-dir <git dir>]
             [--depth <depth>] [--[no-]single-branch]
             [--recursive | --recurse-submodules] [--[no-]shallow-submodules]
             [--jobs <n>] [--] <repository> [<directory>]

<directory>
           The name of a new directory to clone into.
           The "humanish" part of the source repository is used if no directory is explicitly given (repo for /path/to/repo.git and foo for
           host.xz:foo/.git).
           Cloning into an existing directory is only allowed if the directory is empty.

这是紧跟着仓库URI的<directory>参数。


我该如何让git在克隆或推送时要求输入我的http://site.tk的用户名和密码进行身份验证,然后只允许特定用户向特定仓库推送? - shreyansh goel
and to do it in nginx - shreyansh goel
@shreyanshgoel 你需要在一个新的帖子中提出一个新问题,我们一定会帮助你。 - smarber
请访问 https://stackoverflow.com/questions/42163833/ask-username-and-password-for-git-push-nginx。 - shreyansh goel
1
@shreyanshgoel 如果您的“git clone”问题得到解决,您应该接受其中一个答案。 - smarber

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接