LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Blogs > 915086731
User Name
Password

Notices

Rate this Entry

git commit

Posted 01-10-2012 at 09:20 PM by 915086731

Creating and Commiting

$ cd (project-directory)
$ git init
$ (add some files)
$ git add .
$ git commit -m 'Initial commit'

Cloning and Creating a Patch

$ git clone git://github.com/git/hello-world.git
$ cd hello-world
$ (edit files)
$ git add (files)
$ git commit -m 'Explain what I changed'
$ git format-patch origin/master


Basic Commands
$ git status
$ git log


Set Up SSH Keys
~$ cd .ssh
/home/bambreeze/.ssh
.ssh$ ll
total 4.0K
-rw-r--r-- 1 bambreeze bambreeze 1.3K 2011-08-09 21:55 known_hosts
.ssh$ ssh-keygen -t rsa -C "bambreeze@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/bambreeze/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/bambreeze/.ssh/id_rsa.
Your public key has been saved in /home/bambreeze/.ssh/id_rsa.pub.
The key fingerprint is:
...
The key's randomart image is:
...
.ssh$ ls
id_rsa id_rsa.pub known_hosts
.ssh$ vim id_rsa.pub

...
<Add your SSH key to GitHub.>

<On the GitHub site Click “Account Settings” > Click “SSH Public Keys” >Click “Add another public key”>

...
.ssh$ ssh -T git@github.com
Hi bambreeze! You've successfully authenticated, but GitHub does not provide shell access.

Set Up Your Info

Now that you have Git set up and your SSH keys entered into GitHub, it’s time to configure your personal info.

Set your username and email.

Git tracks who makes each commit by checking the user’s name and email. In addition, we use this info to associate your commits with your GitHub account. To set these, enter the code below, replacing the name and email with your own. The name should be your actual name, not your GitHub username.

config$ git config --global user.name "bambreeze"
config$ git config --global user.email bambreeze@gmail.com

Some tools connect to GitHub without SSH. To use these tools properly you need to find and configure your API Token.

On the GitHub site Click “Account Settings” > Click “Account Admin.”
~$ git config --global github.user bambreeze
~$ git config --global github.token <your_token>


Create A Repository @ GitHub
ldd3$ git init
Initialized empty Git repository in /home/bambreeze/workspace/git-space/ldd3/.git/
ldd3$ git add .
ldd3$ git status
...
ldd3$ git commit -m "initial commit for Linux Device Driver (3rd) examples"
Created initial commit ec142ce: initial commit for Linux Device Driver (3rd) examples
99 files changed, 13387 insertions(+), 0 deletions(-)
...
ldd3$ git status
# On branch master
nothing to commit (working directory clean)
ldd3$ touch README
ldd3$ vim README
ldd3$ git add README
ldd3$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: README
#
ldd3$ git commit -m "adding README file for LDD3-Examples project"
Created commit 40db767: adding README file for LDD3-Examples project
1 files changed, 2 insertions(+), 0 deletions(-)
create mode 100644 README
ldd3$ git remote add origin git@github.com:bambreeze/LDD3-Examples.git
ldd3$ git push origin master
Counting objects: 123, done.
Compressing objects: 100% (121/121), done.
Writing objects: 100% (123/123), 100.69 KiB, done.
Total 123 (delta 46), reused 0 (delta 0)
To git@github.com:bambreeze/LDD3-Examples.git
* [new branch] master -> master


Linux Kernel Source of Linus's Tree
git-space$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Initialized empty Git repository in /home/bambreeze/workspace/git-space/linux/.git/
remote: Counting objects: 2132239, done.
remote: Compressing objects: 100% (333476/333476), done.
Receiving objects: 100% (2132239/2132239), 416.26 MiB | 275 KiB/s, done.
remote: Total 2132239 (delta 1779248), reused 2131825 (delta 1778914)
Resolving deltas: 100% (1779248/1779248), done.
Checking out files: 100% (37083/37083), done.
git-space$ cd linux/
/home/bambreeze/workspace/git-space/linux
linux$ git pull
Already up-to-date.
Posted in Uncategorized
Views 3935 Comments 1
« Prev     Main     Next »
Total Comments 1

Comments

  1. Old Comment
    using code tags might make life easier for the viewers.
    Posted 01-11-2012 at 05:53 AM by TheIndependentAquarius TheIndependentAquarius is offline
 

  



All times are GMT -5. The time now is 02:34 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration