9/23/2023 0 Comments Initialize a git repositoryWe will show you a couple of common ways to start using your Git repository. Since Git is very flexible you can start using your repository easily by importing, cloning, and many other ways. There are many different ways to use your Git repository. You need to do this only once, the first time you install Git. Git config -global user.email your full name and email address, and by this you will setup Git for your purposes. git config -global user.name "John Smith" Fire up your command line app such as Terminal (on Mac) or Git bash (on Windows) and run the following commands. Once installed, we recommend initializing Git. You can also install Git from source or use package management, for instance: yum install git-core In case you don't have Git installed in Mac OS, you can download git-scm downloads or use a package manager like homebrew or MacPorts. We've put together a guide on installing Git to Windows. In order to use your git repository first you need to install Git. And now we're ready for the next phase where we look at how to initialize a git repository from Visual Studio.Getting Started with Git & Creating your Repository So let's re add it, I'll go back and do git init. So that's how easy it is to remove the git repository from any folder on your hard drive. Now I've deleted the files that git needs, so if I come back over here, and run git status, I get this message, not a git repository, so I can't find a. Go back over here, and let me delete this. So I haven't done any work yet that needs to be committed to the repository. Now I'll call git log, and I get back this message, fatal, your current branch master doesn't have any commits. And the third line says, there's nothing else to do, there's nothing else to commit or add to this repository and tells us some ways we can mitigate that or add files, will show how to do that later in this course. The second line says we've had an initial commit. The first line says we're on a branch called master. Now let's run some of those other commands, so over here, type in git status, and I get back, three information lines. Because it is directory based, we can rename this folder or move it to another location and git continues to work with that, any configuration changes, again I'm talking about this folder, this command folder. And the same is true for all sub directories that are added to this root folder. One basic concept to understand with git, is that it is a directory based system so any files that we add to this folder, this command folder can be placed in the git repository. You want to use them and manipulate them with git commands or with the Visual Studio IDE. If you want to look, go ahead and double click on this and these are essentially the database files that are used by git, you don't want to be messing with these directly. That's because you shouldn't be messing around with the files that are in here. Now this is a hidden folder, so if I turn off hidden items, they'll disappear. And I can also see it over here in File Explorer. Around the git init command and I can see a message in PowerShell that says, initialized empty git repository in this. We'll look at init, which creates an empty git repository, or reinitializes an existing one, also called git status to look at the working tree status and git log to show the commit logs. We'll look at three of them in this video. This proves that it's available and it also shows some of the git commands that I can run from PowerShell. First step is to test whether git is installed, so I'll type in the word git, press Enter. And I'm also in the same folder, I have it open here over in File Explorer. You'll note that I have navigated to this folder, vsGIT\Command. My favorite way of opening PowerShell, is to hold down the Windows key and tap X and then choose from this list. I'll be working with the git commands, in a console window or a shell window and I'm using PowerShell for that. This action is performed once at the beginning of a project. The first step for utilizing git is to initialize a git repository.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |