git克隆项目一直卡住_GIT:克隆

git克隆项目一直卡住

Unless you are starting the project yourself, the first step to start working on a Git based process is cloning the repository you will be working with. Git provides some simple commands to help us get started.

除非您自己启动项目,否则开始进行基于Git的流程的第一步就是克隆要使用的存储库。 Git提供了一些简单的命令来帮助我们入门。

Normally, remote repositories are repositories that are on computers which are accessible to you via the network. To Git, remote just means somewhere else. But since you may not have another computer handy, we shall work with repositories that are on the same computer but have different paths. Let's go ahead and clone our current repository awesome_project. Git has a command for that and yes, you guessed it right, its $git clone. Of course you need to specify what you need to clone.

通常,远程存储库是计算机上可通过网络访问的存储库。 对于Git来说,远程意味着其他地方。 但是由于您可能没有其他计算机,因此我们将使用同一台计算机上但路径不同的存储库。 让我们继续克隆当前的存储库awesome_project 。 Git有一个命令,是的,您猜对了,它是$ git clone 。 当然,您需要指定要克隆的内容。

If you are working on a different computer, this will probably be a network address. If the repository is hosted on some server, this will be a URL. Right now, we can provide it a path to our awesome_project repository. Let's name our clone our_clone_project.

如果您在另一台计算机上工作,则可能是网络地址。 如果存储库托管在某个服务器上,则它将是一个URL。 现在,我们可以为其提供awesome_project存储库的路径。 让我们将克隆our_clone_project

git克隆项目一直卡住_GIT:克隆_第1张图片

Take a look inside that repository and you can see everything is there as you'd expect. Git has automatically set up our awesome repository as a remote repository for us. Run $ git remote and you shall see that it prints out origin which is our original repository. Let's switch back to our original repository and run $ git remote again.

看一下该存储库,您可以看到所有内容,正如您所期望的那样。 Git已自动将我们很棒的存储库设置为我们的远程存储库。 远程运行命令$ git,你将看到它打印出origin这是我们原来的仓库。 让我们切换回原始存储库,然后再次运行$ git remote

Nothing is printed out. As you can see our original repository is in no way affected by the clone. This is good, since if someone decided to take a look at your code, you don't want your repository to change.

什么都没有打印出来。 如您所见,我们的原始存储库完全不受克隆影响。 这很好,因为如果有人决定查看您的代码,则您不希望更改存储库。

But the problem here is that we want our two repositories to communicate to each other and our awesome_project has no idea that our_clone_project exists. Let's fix that by using the $ git remote add command. You need to provide a name for this add, and using origin does not make sense here. Let's call it our_clone and provide the path to our repository. Poof! That's done!

但是这里的问题是我们希望两个存储库相互通信,而我们的awesome_project不知道our_clone_project存在。 让我们使用$ git remote add命令修复该问题。 您需要为此添加提供一个名称,在这里使用origin毫无意义。 让我们将其our_clone并提供存储库的路径。 of! 大功告成!

git克隆项目一直卡住_GIT:克隆_第2张图片

We can now create new branches, files and work together. But how do we keep up to date with changes in both the repositories. In the next chapter, we'll talk about pushing and pulling our changes between repositories.

现在,我们可以创建新的分支,文件并一起工作。 但是我们如何与两个存储库中的更新保持同步。 在下一章中,我们将讨论在存储库之间推动和拉动更改。

翻译自: https://www.studytonight.com/github/cloning-in-git

git克隆项目一直卡住

你可能感兴趣的:(网络,java,git,python,github)