Nios Community Wiki > GitServer

GitServer

mini-howto setup and use a git server for kernel development

'git' is a version control system written by Linus. It is widely used by kernel developers. You can find tutorials and manuals from git. Another good reference on everyday git usage are the gitmagic guide and the Kernel Hackers' Guide to git.
This page is a brief description of how to use git to access a public server, sopc, which is created to host open-source projects of nios2 and alike. 


This server is located at the Embedded System Lab., Electronic Engineering Department, National Taiwan University of Science and Technology . The server was maintained by Mon-Chau Shie, who is an assistant professor of the Electronic Dept., NTUST. Many thanks for his kind support.
(The server is behind a firewall, and you won't be able to ping.)

All contributions to kernel and u-boot should conform to the Linux kernel coding style; see the file "Documentation/CodingStyle" and the script "scripts/Lindent" in your Linux kernel source directory.

Use the git as a user (readonly)

As user on local machine,

1. install git-core package , as root or via sudo.  (Note, older git packages may have problem. v1.5.2 or higher is required. Try the latest version, or build it from source)
On Fedora,RHEL,Centos,  yum install git-core  ( for Centos, you can add git packages from epel )
On Suse, zypper install git-core gitk
On Debian,Ubuntu, sudo apt-get install git-core

If you have older version, try update. Or better, build from the latest git source, which is 1.5.3.8 at this time of writing.
You can check your installed git version with "git --version" .
If have older version and you want to build from source, uninstall or remove the old package.
http://www.kernel.org/pub/software/scm/git...1.5.3.8.tar.bz2
(later versions are now available - look for them here http://www.kernel.org/pub/software/scm/git/)

tar jxf git-1.5.3.8.tar.bz2 # extract to any directory outside uClinux-dist
cd git-1.5.3.8
./configure
make
sudo make install  # will install git to /usr/local/bin



(UPDATE) Please follow InstallNios2Linux , and switch to the "test-nios2" branch.



MIRRORS
 You can choose the mirror nearest to you and replace the url in remote "origin".

url = http:
//git.opensource.emlix.com/git/nios2/uclinux-dist.git (DE) gitweb = http://git.opensource.emlix.com/  . (Best thanks to emlix.com)




Use the git as a project contributors (can write) 

(If you want to contribute, please send me ,Hippo, an e-mail attaching a public key for ssh access. ie, run 'ssh-genkey' and send me the file ~/.ssh/id_rsa.pub. Please also give me your real name and preferred user name on this server. This will allow you to push the git server.)

As user on local machine, setup your local git as described in previous section.

1. as a user, give your real name as it is a norm in Linux kernel mailing list.
  git config --global user.email "you@email.com"
  git config --global user.name "Your Name"

2. edit .git/config, add ssh to remote origin,

[remote "origin"] 
       url = 
ssh+git://sopc.et.ntust.edu.tw/git/uClinux-dist.git 
       fetch = +refs/heads/*:refs/remotes/origin/*

OR

[remote "origin"] 
       url = 
ssh+git://your_account_name@sopc.et.ntust.edu.tw/git/uClinux-dist.git 
       fetch = +refs/heads/*:refs/remotes/origin/*


3. edit, test, commit...
Please add signoff (-s) to your commits. Please add "nios2:" to the commit message of nios2 arch specific patches, or names of the subsystem or drivers otherwise. See http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#creating-good-commit-messages

git status  # check which files should be committed
git diff the_files_or_subdir_to_be_updated  # double check the diff
git add the_files_or_subdir_to_be_updated
git commit -s  # commit with your signoff, 
git log # have a look at your commit log

If you found any mistakes after commit, you can revert with "git reset --soft HEAD^".

4. when you are ready, you may send your new  commit to the public server
git push

Or, you can submit the patches via e-mail , eg to nios2-dev mailing list.
git format-patch  AAAA..BBBB   # generate patches from commit AAAA to commit BBBB, output numbered patches
git send-email --smtp-server your.mail.server --to whom@where  0001-xxxx.patch


5. if you want to make a lot of changes or develop a new driver, you may create an experimental branch. You can push the branch early so that others can join the test.
git branch my_test_branch
git checkout my_test_branch
...edit,test,commit...
git push origin my_test_branch

6. You can use git-format-patch and git-am to cherry-pick and merge branches, read the man pages.

git format-patch AAAA..BBBB # generate patches from commit AAAA to commit BBBB, create numbered patches 00xxx.patch
git checkout v2.6.23-uc
git pull
git am 00xxx.patch
git log # check again
git push origin v2.6.23-uc




Setup a git server for public

This is how I setup the sopc git server using Debain 4.0. It should be the same for Ubuntu. It is welcome to mirror the sopc server.

Install a minimum system with netinst.iso . As root on server,

0. Add this line, for updated git packages from backports.org .
deb http://www.backports.org/debian etch-backports main contrib non-free
to your /etc/apt/sources.list

1. apt-get install openssh-server apache2 rsync
apt-get -t etch-backports install git-core git-daemon-run gitweb 

2. edit file /etc/apache2/sites-available/gitweb, replace "example.org" with your domain name.

<VirtualHost *>
    ServerName git.example.org
    ServerAdmin webmaster@localhost
    HeaderName HEADER
    # bogus but safe DocumentRoot
    DocumentRoot /var/cache/git
    ErrorLog /var/log/apache2/gitweb-error.log
    CustomLog /var/log/apache2/gitweb-access.log combined
    Alias /robots.txt /var/www/cvs.robots.txt
    Alias /gitweb.css /var/www/gitweb.css
    Alias /git-logo.png /var/www/git-logo.png
    Alias /git-favicon.png /var/www/git-favicon.png
    Alias /git /var/cache/git
    ScriptAlias / /usr/lib/cgi-bin/gitweb.cgi
    RedirectMatch permanent "^/~(.*)$" "http://example.org/~$1
</VirtualHost>

ln -s /etc/apache2/sites-available/gitweb /etc/apache2/sites-enabled/100-gitweb
(optionally, copy png files from git source git/gitweb to /var/www)

(optionally, make link for ssh, ln -s /var/cache/git / )

Note that Step #2 is only required if you want to enable HTTP access to your repository.

3. prepare for publishing, you can place the git in home or ( other shared ?) dir, eg /home/you/git/uClinux-dist.git, then add a symlink in /var/cache/git .

as a user,
cd ~
mkdir git
cd git
mkdir uClinux-dist.git
cd uClinux-dist.git
git --bare init --shared
git remote add --mirror origin git://sopc.et.ntust.edu.tw/git/uClinux-dist.git
git  --bare fetch   # to pull from server at origin, will take some time at first run

The --mirror tag is required so the remote refs (ie: test-nios2) will be stored as a head in your repository instead of a pointer to a remote branch. This is necessary if others need to access your repository.
Since running git-fetch on a bare GIT repository will take a very long time, if you already have a local working copy of the repository on the machine, you can do the following (instead of the above):

cd to local working copy (eg: cd ~/nios2-linux/uClinux-dist.git)
git-clone --bare . <destination for mirror> (eg: git-clone --bare . ~/git/uClinux-dist.git)
cd <mirror> (eg: cd ~/git/uClinux-dist.git)
Remove any branches you don&apos;t want using git-branch -D
git remote add --mirror origin git://sopc.et.ntust.edu.tw/git/uClinux-dist.git
git --bare fetch

Since this already has the test-nios2 branch now (you cloned it), the fetch will be much faster

touch git-daemon-export-ok     # to enable git://
git --bare update-server-info  # to enable http://
chmod a+x hooks/post-update
edit description               # to display on gitweb

You can add a cron job to pull updates from origin daily,
cd /home/you/git/uClinux-dist.git
git --bare fetch


as root, add this link for publishing.
ln -s /home/you/git/uClinux-dist.git /var/cache/git

4. update your DNS server, resolve both names to the same ip. 
git.example.org is the virtual host. 
example.com is the real host.

Summary of branches on sopc server

We have bandwidth issue with our git server at NTUST. To help reduce the network loading, please don&apos;t clone directly from sopc server whenever possible.

binutils.git    binutils 
These patches were merged to buildroot. You won&apos;t need to use this directly.
master : gnu binutils 
nios2-buildroot : nios2 devel for buildroot 
nios2 : nios2eds gnutools 

boards.git    dev board projects 
DE1_SD_Card_Audio : example quartus project and tryout zImage 

elf2flt.git    elf2flt utility 
These patches were merged to buildroot and uclinux.org CVS. You won&apos;t need to use this directly.
nios2 : nios2 devel for elf2flt 
master : sync to elf2flt cvs at uclinux.org daily 

gcc3.git    gcc 3.4 
These patches were merged to buildroot. You won&apos;t need to use this directly.
master : gnu gcc3 
nios2-buildroot : nios2 devel for buildroot 
nios2 : nios2eds gnutools 

insight.git    Insight GDB 
v6_4_nios2 : nios2 devel for insight v6.4 
master : insight 
nios2-buildroot : nios2 devel for buildroot 
gdb : gnu gdb 
nios2 : nios2eds gnutools 

linux-2.6.git    Linux kernel. 
To use this git, please clone from Linus&apos; git and fetch from sopc server. See KernelPatches.
master : sync to Linus&apos; git daily 
v2.6.23-uc : nios2 devel for v2.6.23-uc0 

u-boot.git    Das U-Boot
To use this git, please clone from DENX git and fetch from sopc server.
master : sync to DENX git daily 
nios2 : nios2 devel 

uClinux-dist.git    uClinux distro 
To use this git, please download uClinux-dist-20080131.tar and fetch from sopc server.
nios2 : nios2 devel for uClinux-dist-test (unstable) 
master : nios2 devel for uClinux-dist (stable) 
test : patches of uClinux-dist-test from uclinux.org 


Tag page
Viewing 9 of 9 comments: view all
Very interesting description of how to use git to access server, for hosting open-source projects. Thank you! peter - the portable car gps systems and gps accessories specialist.
Posted 19:14, 29 Jan 2010
Very detailed description of Git Server. I had only basic information about Git, that it was developed by Linus and normally used by the Kernal developers. But here I found many useful information like Server Location and other related things. Thanks for sharing. Beta Alanine Pro
Posted 21:12, 6 Feb 2010
Yes and another helping thing,very Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server.Thank you Fantasia Barrino
Posted 04:23, 7 Feb 2010
I think Git development began after many Linux kernel developers were forced to give up access to the proprietary BitKeeper system.However, the SCMs I've looked at make this hard. One of the things (the main thing, in fact) I've been working at is to make that process really efficient.Thank you. Presentation Skills
Posted 11:20, 9 Feb 2010
Prof Mon-Chau Shie efforts are remarkable and i m great full to him for maintaining server their.I was using it but facing many problems,then i got a tutorial and other helping material form this source of Git.Kernel Hackers also helps to remove these problems.Thanks for posting. avg free download
Posted 06:35, 12 Feb 2010
work from home make money online
Posted 00:12, 24 Feb 2010
This page was created just for you. You can use it to store your contact information, to-do list, or any other information you might want to share with other users. Online Advertising degree AND Online Project Management degree AND social services degree Advertising degree AND Online hr degree
Posted 11:39, 1 Mar 2010
A git server is so good to use. I am trying to do an install into one now. IT is going good. tx asbestos lawyer
Posted 05:23, 4 Mar 2010
he online auction house must pay louis vuitton 200,000 euros, or $275,200, in damages plus 30,000 euros, or $41,300, louis vuitton bags for saleIn the case of any future violations, pay lv handbag a 1,000-euro, or about $1,400, louis vuitton outlet online to an LVMH spokeswoman. In a louis vuitton handbags on sale, eBay said it was disappointed but noted louis vuitton was awarded less than the 1.2 million euros, or $1.7 million, it sought.
Posted 01:19, 9 Mar 2010
Viewing 9 of 9 comments: view all
You must login to post a comment.
SourceForge.net