[HOW TO] install GIT to create and share the project on GitHub

Do you have an GitHub account at http://github.com?

Everyday, you're using Linux operating system. You always install/ combine application, source code on Linux. You should create an account and upload that repository to GitHub.

GIT is a distributed version control system that was created by Linus Torvalds, the mastermind of Linux itself. It was designed to be a superior version control system to those that were readily available, the two most common of these being CSV and SVN.

CVS and SVN use the Client/Server model for their systems, GIT operates a little differently. Instead of downloading a project, making changes, and uploading it back to the server, GIT makes the local machine act as a server.

You download the project with everything, the source files, version changes. Once you are finished, you then merge the project back to the repository.

The article is interesting! I think I should write a tutorial for GIT.

Okay, let's go,

Firstly you must create an account at http://www.github.com

On Debian/ [Ku/Xu/Lu]Ubuntu/ Linux Mint, you can install it using apt-get command

$sudo apt-get install git

You also install from source

$ wget http://kernel.org/pub/software/scm/git/git-1.8.4.tar.bz2 
$ tar xvjf git-1.8.4.tar/bz2 
$ cd git-* 
$ ./configure 
$ make 
$ make install

Now that GIT is installed. In your home directory, there will be a file called ~/.gitconfig. This holds all of your repository information. Let's give it your name and your email.

$git config --global user.name "Your Name"
$git config --global user.email "yourmail@yourdomain.com"

We are going to create the first repository. You make any directory a GIT repository. You use cd command to come it and do the following:

$cd /home/ali33/heineken/
$git init

In this directory, a new hidden directory has been created called ".git". This directory is where GIT stores all of its information about your project. If you dele this directory:

$rm -rf .git

You create a file about your project (e.g. rocky.info)

$vi rocky.info

Added the "rocky.info" file to yuor GIT project.

$git add rocky.info

If you want to add all of file/folder in the project, you use command as below:

$git add .

Now you are ready to commit the project to a stage, meaning that this is a marker point in the project. You do this with the git commit "-m" command where the "-m" option specifies a message you want to give it.

$git commit -m 'first project'

Okay, you are ready to push the project up to GitHub. You will need the login information that you made then created an account.

$git remote set-url origin your_user@github.com:your_uer/repository/
$git push origin master

That's it! Now you can go the https://github.com/username/ropository link to see your own git project.

You also config the git configuration via command:

$git config -e

Or go to source path:

$sudo -s
#cd /tmp/github/.git
/tmp/github/.git#
/tmp/github/.git#ls -al
total 44
/tmp/github/.git#drwxr-xr-x 7 root  root  4096 Dec 26 19:25 .
/tmp/github/.git#drwxrwxr-x 3 ali33 ali33 4096 Dec 26 18:47 ..
/tmp/github/.git#drwxr-xr-x 2 root  root  4096 Dec 26 18:40 branches
/tmp/github/.git#-rw-r--r-- 1 root  root   259 Dec 26 19:35 config
/tmp/github/.git#-rw-r--r-- 1 root  root    73 Dec 26 18:40 description
/tmp/github/.git#-rw-r--r-- 1 root  root    23 Dec 26 18:40 HEAD
/tmp/github/.git#drwxr-xr-x 2 root  root  4096 Dec 26 18:40 hooks
/tmp/github/.git#-rw-r--r-- 1 root  root   104 Dec 26 18:48 index
/tmp/github/.git#drwxr-xr-x 2 root  root  4096 Dec 26 18:40 info
/tmp/github/.git#drwxr-xr-x 5 root  root  4096 Dec 26 18:48 objects
/tmp/github/.git#drwxr-xr-x 4 root  root  4096 Dec 26 18:40 refs
/tmp/github/.git#vi config

If you don't upload to GitHub and received error such as:

#git push origin master
Assh: connect to host github.com port 22: Connection timed out

You must check to ensure port 22 local is opened


#nc -v -z 127.0.0.1 22

Connection to 127.0.0.1 22 port [tcp/ssh] succeeded!


Okay, the port 22 ready. You should contact network administrator. Because network don't allow port 22 for you, for your department.

Understandable, it is a master of security infrastructure businesses. Thay need to ensure a minimum of things that can go internet.

That's it. I'm going to sleep :D see you.

P/s: big thank tecmint.com that sharing.




Thank you for reading this article, please a comment if you are interested.
Tiến Phan - R0039
Knowledge is Endless
Sharing for Success



0 nhận xét:

Post a Comment