繁体   English   中英

创建本地git存储库而不是使用github

[英]Creating a local git repository instead of using github

我知道在项目X中可以执行git init但是如何创建一个过于本地化的地方呢? 因此,例如,我使用投递箱,我想在那里创建一个git repo来执行git push drop-box

我做了: git init --bare在投递箱文件夹中,然后尝试执行以下操作:

git add remote origin "/Users/Adam/Documents/rpg maker/the-child-and-the-poet-repo/"
fatal: /Users/Adam/Documents/rpg maker/the-child-and-the-poet-repo/: '/Users/Adam/Documents/rpg maker/the-child-and-the-poet-repo/' is outside repository

但是如您所见,这没有用。 有想法吗?

我在上面的注释中提供的链接是使用DropBox的方法,但是我认为使用一组更通用的说明来创建本地Git存储库可能会有用,所以就在这里。

您仅需三个命令即可初始化本地Git存储库。 C:/驱动器(在Windows上)中键入:

mkdir newrepo.git
cd newrepo.git
git init --bare

现在,您可以将本地存储库的副本克隆到另一个本地位置:

git clone C:\newrepo.git newrepo

git clone命令会将newrepo克隆到一个名为/newrepo的目录中。 它将在其中初始化一个.git目录,并下拉整个存储库内容。 此外,它将签出工作副本(通常是master ),这是您将开始的分支。

现在您可以开始工作了,从现在开始,所有常用的Git命令都是公平的游戏。

请查看这个很棒的博客以获取更多信息。

暂无
暂无

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

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