Github仓库名称和本地文件夹名称的对应关系

14

我已经将我的应用程序源代码(Git存储库)存储在文件夹中:

MyProject/front_app

但是在GitHub上,我想把存储库的名称命名为不是front_app而是my_project_front_app,这可能吗?

这是一个好方法还是更好地为这个git repo创建本地文件夹my_project_front_app

2个回答

25

你可以随心所欲地进行操作。本地仓库和远程仓库可以具有不同的名称。

如果你已经有了一个本地仓库,你可以使用以下命令添加一个远程仓库(名称可以自定义):

git remote add origin http://distant/a_remote_repository
如果您已经有一个GitHub代码库,您可以使用以下命令将其克隆到想要的本地文件夹中:
git clone http://distant/a_remote_repository a_different_local_folder

2

GitHub仓库、本地克隆以及其他代码副本的命名并没有必须相同的理由。除了方便你和合作者清楚明了之外,这样做也没有任何实际优劣之分。

git clone <url> <path> ;# path is a variable; it's the url that's well-defined
git remote add <name> <url> ;# as can be seen in the 'git remote add' command

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