1.1 install Git-Core in Ubuntu server
sudo apt-get install git-core
1.2 install Gitosis in Ubuntu server
sudo apt-get install python-setuptools
mkdir ~/src
cd ~/src
git clone https://github.com/res0nat0r/gitosis.git
cd gitosis
sudo python setup.py install
2. Configuration
2.1 Enable ssh service in Ubuntu server
to use ssh-server, must open port 22 for
install ubuntu open ssh
sudo apt-get install openssh-server
to make sure ssh server enable or not, run ps -e | grep ssh
if only can see ssh-agent, means ssh-server not start yet, if see sshd means, ssh-server already start.
And then restart ssh server
run : sudo /etc/init.d/ssh restart
3. Add new user
3.1 cd to gitosis-admin
copy new user's id_rsa.pub to keydir folder, named as new_user.pub
3.2 edit gitosis.conf
vim gitosis.conf
edit as follow:
[group ProjectName]
members = old_user1 old_user2 new_user
writable = ProjectName
save and exit
3.3 back to gitosis-admin folder, push the change to server, then the sever will allow new member to download
git add .
git commit -am "add new user"
git push
Now the user can clone from the new user
4. Create new project
4.1 in local pc, open gitosis.conf, enter
[group NewProject]
members = matthewlu@mamembers = matthewlu@matthews-MacBook-Pro.local vic mac_mini
writable = NewProject
save and exit
push the change to server
git commit -am "create a new project"
git push
4.2 in server, in repositories folder , create a new folder
mkdir NewProject
cd to NewProject
Init a new git repository
git init --bare
4.3 in local machine
Create the NewProject
mkdir NewProject
git init
git remote add origin admin@YOURSERVER:NewProject
git add .
git commit -am "init a new project"
git push origin master
5. Create .gitignore for new create Xcode git project
5.1 touch .gitignore
The location of .gitignore is same as .git, .gitignore is not inside .git
5.2. vim .gitignore
add the content below to .gitignore
# Mac OS X
*.DS_Store
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
# Generated files
*.o
*.pyc
#Python modules
MANIFEST
dist/
build/
# Backup files
*~.nib
Then save and exit
5.3 add .gitignore to git
git add .gitignore
git commit -am "create .gitignore file"
git push origin master
6. Add ssh key to server
get the publick key key.pub
copy the key content to server authorzied_key
refresh ssh
7. gitignore file for visual studio
#
# Windows and Mac OS X Temp Cache Files
#
[Tt]humbs.db
*.DS_Store
#
#Visual Studio files
#
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
ipch/
obj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
#
#Tooling
#
_ReSharper*/
*.resharper
[Tt]est[Rr]esult*
#
#Project files
#
[Bb]uild/
#
#Subversion files
#
.svn
#
# Microsoft Office Temp Files
#
~$*
# End of File
8. windows connect to ubuntu server
the path format is below:
192.168.1.26:repositories/EngagerIntranet.git
No comments:
Post a Comment