Tuesday, October 18, 2016

Using Git with github

For last couple of weeks I am working on a small Income/Expense tracking application. It's a small pet project of mine. It's main purpose is for me to get familiar with latest features in QML and code for various scenarios in a live app.
Recently I put together another point release for this - a version 0.3. Now I needed somewhere to keep track of it's development and manage changes better than a desktop folder and datewise backups. So I thought I should setup a Git repository for this.
So I created a github account and created a repository. To import my project into this, I tried to use a GUI Client, gitg which I thought would be easier to use than stumbling around the commands. 
Unfortunately gitg gave an error regarding .gitg-config something file. I didn't have time to shoot it down, so I used the five-six commands shown in github repository page to setup empty repository on PC. 

The commands are:

$echo "# UIApp" >> README.md
$git init
Initialized empty Git repository in /home/vaibhav/Work/.git/
$git commit -m "first commit"

*** Please tell me who you are.


  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'vaibhav@HP-Elite-7100-Microtower-PC.(none)')

$git config --global user.email "xxx@xxx.com"
$git commit -m "first commit"
$git push -u origin master

After going through these commands, I checked the repository on github, the first commit was visible. 
OK. Now I copied project files from other folder. Then opened repository with gitg.
Now gitg showed it correctly. The new files were shown as unstaged. So I added them to staged and tried to commit. Gitg asked for updated author info. I went to Author info dialog and updated my name. After this I tried to commit again. This time commit was done. But this was a local commit, and I couldn't find anyway from github to sync this to github master repository.
So I tried following command, it worked and it was synced with master branch at github.

$git push -u origin master

Now my project is on GitHub at: https://github.com/vaibhavsdlv/UIApp.git

No comments:

Post a Comment