質問

What's the standard start-up process: git init + git clone or should git clone do the init for us?

I have been using git in my workplace, and now one of my co-workers wants to start looking at my code.

I have been using the GitHub for Windows (G4W) posh-git PowerShell to run my git commands (not the GUI and not using www.github.com). My co-worker has also installed G4W, and I am leading them via the CLI rather than the GUI.

When I went to help them get started, I made a new folder, opened our posh-git shell that comes with G4W, and did a git clone from our repo on the network share.

After that I did a git status, and posh-git was not recognizing the folder as a local git repo.

I then did a git init on the folder, and it seems OK, but I'm wondering why git clone did not effectively make the folder a repo?

Searching the web for git docs and how-to, I haven't seen anything that says I should do git init before git clone.

What is the right order or is there a correct order?

役に立ちましたか?

解決

It's just git clone remote://git-repo/url. You do not need to initialize anything if you can clone.

Note that having a remote URL that ends in something like "reponame.git" will create a new directory named "reponame" in which the repository will be created, NOT the directory you are currently in.

So if you run git status right after git clone, you are in the wrong directory, you have to cd into it first.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top