
This file overrides both of the other files. This file overrides /etc/gitconfig.Ĭonfiguration that is specific to a repository. LocationĬontains settings that are system-wide and apply to all users and all of their repositories.Ĭonfiguration that is specific to your user account. There are three places on your system where git keeps its configuration information. You'll want to peek at this file periodically after you make changes to your git repository configuration. No need to do anything or make any changes, just take a look at it. git directory to take a look at its files. git directory like any other normal directory. If you pass it the -a flag, it will display hidden files. The ls command lists the current directory contents and by default will not show hidden files. git directory is a configuration file for git. Your operating system uses many hidden files for system configuration purposes and the. Hidden files are normally not shown to the user by the operating system. This directory will contain all of the configuration and metadata necessary for git to keep track of our files and the changes that we make to them. It only removes the git repository from the current directory.git DirectoryĪfter you type git init, a directory named. git directory doesn't uninstall the git application or affect the other git repositories on your computer. If you've accidentally typed that command in a directory that you didn't want to turn into a git repository, all you have to do is delete the. It's important to only issue the git init command from within the directory that you wish to turn into a git repository. You need to move other_project to ~/dev/other_project. That means that if ~/dev/project is a repository, ~/dev/project/other_project should not be another repository. After you initialize a directory as a git repository, you can start issuing other git commands.ĭo not nest your repositories. Conceptually, you can think about it as turning that directory into a git repository. git directory was added to the git_basics directory. Technically, the only thing that changed was a. The Initialized message means that git "initialized", or created, a new repository in your current directory. On the command line, from within the git_basics directory, type the following: $ git init We're now ready to create a local repository. Throughout the remainder of this book, we assume that you are using the main branch as your default. If this command doesn't work, try this one: git branch -M main However, you will have to do this for every new repo. To change the name after you make the first commit to your repo.


Alternatively, you can run: git add -move master main If that happens, you can ignore the error and continue to use master wherever we mention main. If you are using an older version of git (pre 2.28), the above command won't work. The best way to accomplish this is to change your default branch name to main: $ git config -global faultBranch main

You want to make sure that both git and GitHub are using the same branch name, so we'll use main. git initĪs of late 2020, GitHub uses main as the name of your primary branch - it used to use master, but git still defaults to master. We are using markdown here because it is readable as plain text and will render nicely when we share our repository on in the next section. These particular files use the markdown format. The files above, README.md and LICENSE.md, are for demonstration purposes only, though they are included in the root directory of many open source projects.
Git add remote folder license#
These two commands, thus, create 2 files, README.md and LICENSE.md, each of which starts with a simple comment ( # README #, # LICENSE #). This operator takes the output of the command and places it in the file whose name appears to the right. The > character on lines 3 and 4 above is the redirection operator.
