Git client configuration for a local server.

Gitlab Logo

Gitlab Logo

Configuring a git client can be painful sometimes if you are a beginner. I struggled the first time I configured git too. So I am creating this material for others like me to be able to configure git. I hope it works for you. Git is now a days one of the most popular versioning systems. I use git since a few months ago to keep my Symfony 2 projects update.

Configure gitclient with you User name:

git config --global user.name "Abel Guzman"

Initialize the global user for gitclient using your mail e-mail:

git config --global user.email "abel@ltu.sld.cu"

Now using cd you should load the folder of the project. if it does not exist you should create it.
Initialize the gitclient:

git init

Create .gitignote file to ignore your logs and cache. This is optional, only if you have files to ignore.

nano .gitignore

Content of the file:

/app/cache
/app/logs

You can add any thing else you want to be ignored by gitclient.

Add everything in you cade to the project, except for the content of .gitignore.

git add .

If you are starting from ground you can just add the readme file:

touch README.md
git add README

Create the comint for the project. in this case the first commit… but you can repeat this activity as many times as you want.

git commit -m 'first commit'

Add a private git server. We have our own git lab server and we normally put the projects there.

git remote add origin git@gitlab.ltu.sld.cu:abel/teamerp.git

Generate key for the project if it does not exists.

Generate key:

ssh-keygen -t rsa -C "$abel@ltu.sld.cu"

See the content of the key:

See the query result:

cat ~/.ssh/id_rsa.pub

Push the code to the master branch (upload to the server):

git push -u origin master

At this point you might want to remove things.

git rm -r blue_white/

Of course then you are supposed to execute a commit and a git push. And that’s it for today. Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *