简体   繁体   English

我可以在没有 Github 或类似的情况下制作本地(仅限)git 存储库吗? 这就是“初始化存储库”的作用吗?

[英]Can I make local (only) git repository without Github or similar? Is that what "Initialize Repository" does?

I want to do git-based version control, but with all my (committed or otherwise) files only on my local drive, without syncing or committing or communicating in any way to/with GitHub's or anyone else's servers anywhere.我想做基于 git 的版本控制,但我所有的(提交的或其他的)文件只在我的本地驱动器上,而不以任何方式与 GitHub 或任何其他人的服务器同步、提交或通信。

VSCode's documentation describes two options: "Initialize Repository" or "Publish to GitHub". VSCode 的文档描述了两个选项:“初始化存储库”或“发布到 GitHub”。

So is a repository something that must be on GitHub, or does "Initialize Repository" allow me to create a repository on my local machine, with all version control managed and stored on my local drive, without anything ever being uploaded to a GitHub account?那么存储库是否必须在 GitHub 上,或者“初始化存储库”是否允许我在本地计算机上创建存储库,所有版本控制都管理并存储在我的本地驱动器上,而无需将任何内容上传到 GitHub 帐户?

If it's possible, are there any special steps I need to take or does the "Initialize Repository" option mean it's all local intrinsically (because it's the alternative to "Publish..."?)如果可能的话,我是否需要采取任何特殊步骤,或者“初始化存储库”选项是否意味着它本质上都是本地的(因为它是“发布......”的替代方案?)

First of all this is something you could simply try;-)首先,您可以简单地尝试一下;-)

Initialize Repository will create a new local repository. Initialize Repository 将创建一个新的本地存储库。

Unless you define a remote repository and push your commits nothing will leave your computer.除非您定义一个远程存储库并推送您的提交,否则什么都不会离开您的计算机。 Usually it is a good idea to use a remote repository so you can synchronize your code with other developers, other workstations and have a backup copy of your codebase.通常使用远程存储库是个好主意,这样您就可以与其他开发人员、其他工作站同步您的代码,并拥有您的代码库的备份副本。

So is a repository something that must be on GitHub GitHub 上的存储库也是如此

No a respository is just a bunch of extra files, added to your project.没有存储库只是添加到您的项目中的一堆额外文件。 The local git repository is in a hidden folder named.git which is placed in the root folder of your project (where you created the git repository).本地 git 存储库位于名为 .git 的隐藏文件夹中,该文件夹位于项目的根文件夹中(您在其中创建了 git 存储库)。

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

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