Getting Started With Git and Github on Fedora

Git-Icon-1788CThis post is going to be a very simple overview of the steps that you need to follow to get started with Git and Github on Fedora. Nothing fancy here at all, just the basics of what you need to know so that you can get up and running with pushing and pulling code. Note that these instructions assume that you have installed the Git client already, and that you are running a Linux based desktop distro with the KDE desktop environment (yes, I know that’s redundant).

Creating Your First Repository

So this is a pretty simple process. First you are going to want to navigate to https://github.com in your browser. Once there you need to go ahead and create a free account. Create a Username and Password.

github_singupOnce you have completed the steps required to create a new account, and have chosen your account type (free – right?) you then need to create a New Repository. Just click on the green button on the right hand side of the page. You will need to choose a name for your new repository. Select “Initialize this repository with a README” to seed your repo so that you can perform your first clone procedure.

create_new_repo

Since we are down to the business of keeping things simple, let’s say that you have created the user Fatmin, and that the repository that you created is called test. This would have created the repository at the following URL – –https://github.com/Fatmin/test.git.

Now that our repo has been created, lets jump on our Linux box and perform our first pull. First, create a directory that will house your cloned repo. For this purpose we have created ~github/fatmin/test. Now navigate to that directory and run the command below to pull initialize your local repo and pull down your code.

#git init && git pull https://github.com/Fatmin/test.git

KDE prompts us for the Username and Password that we used to create our Github account. If you are using KDE Wallet, you can save these credentials.

kde-git

Pushing Your Code to Github

Now lets add a new file into our newly created local Git repo. For our test purposes we are going to create a test file, aptly named test.bash. Lets pretend that this is file is not empty, but rather, is a very advanced bash script that humbles any that dare gaze upon its beauty. First we must add the file to the local Git repo along with a comment that will be checked-in along with the script. Rule of thumb here… the more detail the better.

#git add test.bash && git commit -m “added test.bash file to local repo”

Now lets tell our local Git repo where its remote copy is housed. We accomplish this by adding a remote origin.

#git remote add origin https://github.com/Fatmin/test.git

Now lets push our new file, test.bash, to our remote Git repo on Github.

#git push origin master

Expect to be prompted for your Github credentials again. Once you successfully authenticate to Github, you should be able to see your newly pushed file in the Github WebUI.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s