Git installation and usage

1. Downloading source code from the official website:

    http://git-scm.com/downloads

Or git it from github:

1 git clone https://github.com/git/git

2. Entering the extracted folder and typing these commands in terminal:

1 make prefix=/usr/local all
2 sudo make prefix=/usr/local install

in the make step, I met a problem: curl.h: there is no such file or directory

After reading this page, problem solved by :

1 sudo apt-get install libcurl4-openssl-dev

3. Check git version in terminal:

1 git --version

4. First you need to tell git your name, so that it can properly label the commits you make.

git config --global user.name "Your Name Here"

5. Git saves your email address into the commits you make. We use the email address to associate your commits with your GitHub account.

1 git config --global user.email "your_email@example.com"

 6. Make a directory as a master git directory

1 git init

7. Add and commit a file

1 git add README
2 git commit -m "first commit"

8.  Push a commit

1 git remote add original https://github.com/username/Hello-World.git
2 git push origin master

 

 ------------------------------------------Added Apr 18-----------------------------------

9. Delete a file or directory

1 git rm -r -f filename (if delete a directory, -r is neccessary)
2 git commit -m "delete"
3 git push origin master

 

 

 

posted @ 2014-04-16 08:16  Zuliu  阅读(274)  评论(0)    收藏  举报