Tutorials

Git HowTo

Git Access

To get access to a git repository, you first need to create one (for example on github or gitlab).

Git Usage

Supposed the url of the repository is named “repo”, then you can check out a local copy of the repository with the following command on the unix terminal:

git clone repo

This is called the check-out line. Usually you find that line on the web page of the repository provider.

If the repo ist a private one, you will have to provide your credentials of course. So please enter those when checking out the repo. If you want git to remember those credentials you can configure it like so:

git config --global credential.helper store

You may also want to tell git who you are before working with a repo:

git config --global user.email "name@domain.co"
git config --global user.name "nickname"

Now your can develop code by modifying that local copy.

For example, you can add a file to the local copy:

git add filename

One of the first files that you should add to your repo is a so called gitignore file:

git add .gitignore

If you are done with your changes, you need to commit all local modifications as a new check in:

git commit -a -m "commit log"

This commit is one additional step in the version history of your repository. It shows up with the commit log as a comment.

And finally you need to transmit all committed check-ins to the repo on the server:

git push

There’s also the other way round: To transmit all commited check-ins that others may have committed from the server to your local copy:

git pull

This may require a merge operation, if the there are conflicts. So be sure that you do not modify parts others may be working on unless you really know what you are doing!

Happy coding!

Options: