Global configuration file
Git allows you to store global settings in the .gitconfig file. This file is located in the user home directory. Git stores the committer and author of a change in each commit.
Configure your user and email for Git via the following command.
$ git config --global user.name "Your Name Here" # Sets the default name for git to use when you commit $ git config --global user.email "[email protected]" # Sets the default email for git to use when you commit
Getting started with Git
Fire up a terminal, and type (replace Rails_app with name of the your application):
$ rails new Rails_app
Afterwards, navigate into this new directory by typing:
$ cd Rails_app
Initialize Git inside this directory by typing:
$ git init
Create a new file by typing:
$ touch README
Add this file to the repository by typing:
$ git add README
Now, let’s make a change to this file, by writing something to it
$ echo "Hello, is this on Github?!" > README
Now, we need to commit. Committing is a small message of what you just did:
$ git commit -m 'Initial commit'
Next, we need to add the online Github repository (the origin)
$ git remote add origin [email protected]:User/Rails_app.git
And finally, let’s push it to Github.
$ git push origin master
Now you’ve added your first file to Github! Continue to learn more about how to work with Git.