轉(zhuǎn)載請注明出處:http://blog.csdn.net/u011479494/article/details/50629669
相比gitosis粉私,gitolite的功能更為強大抄肖,支持對權(quán)限的細(xì)分控制,下面在最新版 的ubuntu 14.04 LTS中搭建gitolite服務(wù)器幌甘。
一、安裝準(zhǔn)備
1.服務(wù)器安裝openssh
sudo apt-get-yinstall openssh-serveropenssh-client
2.在一臺管理客戶機上生成ssh公鑰【客戶機執(zhí)行】
ssh-keygen-trsa
生成的公鑰在/home/xia/.ssh/里面皱埠,默認(rèn)名字是id_rsa.pub训枢。
3.安裝git忘巧,在這個核心軟件恒界,不可或缺。
sudo apt-get-yinstall git
二砚嘴、安裝gitolite
在ubuntu中已經(jīng)集成了十酣,不用自己去下載。
sudo apt-get-yinstall gitolite
三际长、配置gitolite
1.創(chuàng)建用戶gitolite【服務(wù)器執(zhí)行】
添加gitolite用戶和同名用戶組耸采,加上–system參數(shù)嘱朽,用戶就不會在登陸界面顯示。
sudoadduser--system--shell/bin/sh--group--disabled-password--home/home/gitolitegitolite
2.把管理客戶機生成的公鑰上傳到服務(wù)器上【客戶機執(zhí)行】
scp ~/.ssh/id_rsa.pub berry@192.168.100.249:/tmp
3.初始化配置【服務(wù)器執(zhí)行】
切換到gitolite用戶環(huán)境中猖毫,因為我要以gitolite用戶身份去初始化安裝。
sudo chmod777/tmp/id_rsa.pubmv /tmp/id_rsa.pub/tmp/xia.pubsudo su - gitolitegl-setup /tmp/xia.pub
以上命令有兩個個作用:
a)建立一個目錄“~/repositories”沛厨,用來存儲所有g(shù)it倉庫粹胯;
b)把公鑰文件id_rsa.pub添加到 ~/.ssh/authorized_keys潜索。
4.修改配置文件
gitolite的配置文件本身就是一個git倉庫瞎领,gitolite的配置修改就是通過git實現(xiàn)的殿遂,先clone下來修改蜕企,再push上去。只要push上去臀蛛,gitolite會立刻監(jiān)視到配置文件的修改并應(yīng)用洲劣。
在管理客戶端clone管理庫到本地:git clone gitolite@192.168.100.249:gitolite-admin.git
或者git clone ssh://gitolite@192.168.100.249/gitolite-admin.git
clone下來以后样傍,庫里有一個文件夾conf,里面存儲的是gitolite.conf(配置文件);還有一個文件夾keydir糊秆,里面存儲的是用戶的公鑰文件觉增,當(dāng)前里面就有在管理客戶端上生成的私鑰(格式是”用戶名.pub”,例如“xia.pub”)幼苛。
四溉旋、添加用戶和倉庫
添加新倉庫也非常簡單褐筛,假設(shè)你要添加一個叫l(wèi)v@example.com的用戶,再創(chuàng)建一個倉庫叫testing紧唱,并賦給lv修改權(quán)限活尊。
【在lv私鑰計算機上操作】
1.首先ssh-keygen生成lv的公鑰和私鑰;
【在xia私鑰計算機上操作】
2.把lv公鑰(lv.pub)拷貝到本地gitolite-admin庫的keydir里面漏益;
3.編輯本地gitolite-admin庫里的conf下的gitolite.conf蛹锰,添加:
repo? ? gitolite-admin? ? ? ? RW+? ? =? xiarepo? ? testing? ? ? ? RW+? ? =? @all++repo? ? test+? ? ? ? RW+? ? =? lv
4.commit修改,push到服務(wù)器生效绰疤。服務(wù)端自動創(chuàng)建空的test.git工程倉庫铜犬。
Compressing objects:100% (3/3), done.Writing objects:100% (4/4),356bytes |0bytes/s, done.Total4(delta1), reused0(delta0)remote:creating test...remote:Initialized empty Git repositoryin/home/gitolite/repositories/test.git/To ssh://gitolite@192.168.100.249/gitolite-admin.gitb5e8b3d..be1d3f1? master -> master
5.初始化倉庫并push到服務(wù)器
【在lv私鑰計算機上操作】
git clone ssh://gitolite@192.168.100.249/test.git或者:git clone gitolite@192.168.100.249:test.gitcd testecho"init commit"> readme.txtgitadd.git commit -m"init commit"gitpushorigin master
6.添加一個存在的Git項目
如果你有一個已經(jīng)存在的項目,也想將其添加到Gitolite的服務(wù)器里峦睡。首先你依然需要在gitolite.conf里注冊這個項目翎苫。然后執(zhí)行下面的操作:
cd testgit remote rm origingit remoteaddorigin gitolite@192.168.100.249:test.gitgitpushorigin master
如果你有多個branch,那么checkout到那個branch榨了,執(zhí)行
git push origin
五煎谍、搭建 Android repo 管理 服務(wù)器
1.搭建 git-daemon
(1)安裝git-daemon-sysvinit
sudo apt-getinstall git-daemon-sysvinit
(2)配置 /etc/default/git-daemon
sudovi /etc/default/git-daemon
# Defaults for git-daemon initscript# sourced by /etc/init.d/git-daemon# installed at /etc/default/git-daemon by the maintainer scripts## This is a POSIX shell fragment#GIT_DAEMON_ENABLE=trueGIT_DAEMON_USER=gitoliteGIT_DAEMON_BASE_PATH=/home/gitolite/repositoriesGIT_DAEMON_DIRECTORY=/home/gitolite/repositories# Additional options that are passed to the Daemon.GIT_DAEMON_OPTIONS="--export-all --enable=upload-pack --enable=upload-archive --enable=receive-pack --informative-errors"
配置分析:
1)GIT_DAEMON_ENABLE=true 很明顯得設(shè)置成true值了 。
2)GIT_DAEMON_USER=gitolite 表示使用哪個用戶運行g(shù)it-daemon龙屉。
注意:設(shè)置的這個用戶一定得對GIT_DAEMON_BASE_PATH有讀呐粘,寫满俗,執(zhí)行的所有權(quán)限!
3)GIT_DAEMON_BASE_PATH=/home/gitolite/repositories 設(shè)置根目錄作岖。
比如像我的這個設(shè)置唆垃,那么你在用git clone gitolite://192.168.100.249/test.git時,git服務(wù)器就會查找/home/gitolite/repositories/test.git目錄了痘儡。
4)GIT_DAEMON_DIRECTORY=/home/gitolite/repositories 這個是設(shè)置成目錄白名單whitelist辕万。
如果不設(shè)置的話用戶在git操作時如git clone,git push等等會出現(xiàn)no such directory。而在服務(wù)器機器上/var/log/syslog中會看到’/home/gitolite/repositories/xxx.git’: not in whitelist 沉删。
5)GIT_DAEMON_OPTIONS=”–export-all –enable=upload-pack –enable=upload-archive –enable=receive-pack –informative-errors” 設(shè)置參數(shù)渐尿。
如果想上傳,且全部導(dǎo)出矾瑰,就設(shè)置–export-all –enable=upload-pack –enable=upload-archive –enable=receive-pack 砖茸。
注意:如果出現(xiàn)找不到的話,就在/home/gitolite/repositories目錄下面的項目倉庫目錄下touch git-daemon-export-ok殴穴,生成一個這個名字的文件即可凉夯。
如果想使用git push功能,那一定要打開–enable=receive-pack 采幌。
以上設(shè)置好了只后劲够,,那么每次開機就會自己啟動了植榕。
還可以使用sudo service git-daemon start|restart|stop控制再沧。
sudo /etc/init.d/git-daemon start|restart|stop也可以了。
2.添加manifest.git倉庫
1)【在xia私鑰計算機上操作】
編輯本地gitolite-admin庫里的gitolite.conf尊残,添加:
repo? ? manifest
RW+=xia
commit修改,push到服務(wù)器生效淤堵。
2)下載manifest.git到本地
git clone gitolite@192.168.100.249:manifest.git
3)添加dfault.xml
這個文件是跟這個Android 源碼 配套的寝衫,沒有自己可以參考別人的創(chuàng)建一個,
path 表示客戶端本地路徑拐邪,使用 cat default.xml | cut -d ‘”’ -f 2 提取慰毅,
name 表示服務(wù)端遠(yuǎn)程路徑,使用 cat default.xml | cut -d ‘”’ -f 4 提取扎阶。
將上面的default.xml 文件push 到倉庫:
gitadddefault.xmlgit commit -m"add default.xml"gitpushorigin master
4)給manifest.git倉庫添加新成員berry(服務(wù)器端的默認(rèn)登錄用戶)
【在服務(wù)器上使用berry用戶操作】
生成berry用戶的秘鑰汹胃,并將公鑰拷貝到遠(yuǎn)程xia私鑰計算機的/tmp目錄下
ssh-keygen -t rsascp ~/.ssh/id_rsa.pub xia@192.168.100.181:/tmp
【在xia私鑰計算機上操作】
將berry用戶的公鑰拷貝到本地gitolite-admin庫里的keydir目錄下:
cp/tmp/id_rsa.pub~/gitolite-admin/keydir/berry.pub
編輯本地gitolite-admin庫里的gitolite.conf,修改:
repo? ? manifest-? ? ? ? RW+? ? =? xia+? ? ? ? RW+? ? =? xia berry
commit修改东臀,push到服務(wù)器生效着饥。
3.創(chuàng)建服務(wù)器上的android源碼版本庫
1)獲取default.xml文件
【在服務(wù)器上使用berry用戶操作】
cd ~/Download/git clone gitolite@192.168.100.249:manifest.git
【在服務(wù)器上使用gitolite用戶操作】
sudosu - gitolitecd~cp /home/berry/Downloads/manifest/default.xml ./
2)生成server.txt
使用 cat default.xml | cut -d ‘”’ -f 4 > server.txt
生成server.txt,將無關(guān)的字符刪除
-UTF-8--Makefile--
得到一個服務(wù)端路徑的文本 server.txt
yazuo/platform/buildyazuo/platform/abi/cppyazuo/platform/artyazuo/platform/bionicyazuo/platform/bootable/bootloader/lkyazuo/platform/bootable/diskinstalleryazuo/platform/bootable/recoveryyazuo/platform/ctsyazuo/platform/dalvikyazuo/platform/developers/buildyazuo/platform/developers/samples/androidyazuo/platform/developmentyazuo/device/asus/debyazuo/device/asus/floyazuo/device/asus/flo-kernelyazuo/device/asus/grouperyazuo/device/asus/tilapiayazuo/device/commonyazuo/device/generic/armv7-a-neonyazuo/device/generic/commonyazuo/device/generic/goldfishyazuo/device/generic/mipsyazuo/device/generic/mini-emulator-armv7-a-neonyazuo/device/generic/mini-emulator-mipsyazuo/device/generic/mini-emulator-x86yazuo/device/generic/x86yazuo/device/google/accessory/arduinoyazuo/device/google/accessory/demokityazuo/device/lge/hammerheadyazuo/device/lge/hammerhead-kernelyazuo/device/lge/makoyazuo/device/lge/mako-kernelyazuo/device/sampleyazuo/device/samsung/mantayazuo/platform/docs/source.android.comyazuo/platform/external/aacyazuo/platform/external/android-clatyazuo/platform/external/android-mockyazuo/platform/external/ant-globyazuo/platform/external/antlryazuo/platform/external/apache-harmonyyazuo/platform/external/apache-httpyazuo/platform/external/apache-xmlyazuo/platform/external/arduinoyazuo/platform/external/bisonyazuo/platform/external/blktraceyazuo/platform/external/bluetooth/bluedroidyazuo/platform/external/bouncycastleyazuo/platform/external/bsdiffyazuo/platform/external/bzip2yazuo/platform/external/ceres-solveryazuo/platform/external/checkpolicyyazuo/platform/external/chromiumyazuo/platform/external/chromium-libpacyazuo/platform/external/chromium-traceyazuo/platform/external/chromium_orgyazuo/platform/external/chromium_org/sdch/open-vcdiffyazuo/platform/external/chromium_org/testing/gtestyazuo/platform/external/chromium_org/third_party/WebKityazuo/platform/external/chromium_org/third_party/angle_dx11yazuo/platform/external/chromium_org/third_party/eyesfree/src/android/java/src/com/googlecode/eyesfree/brailleyazuo/platform/external/chromium_org/third_party/freetypeyazuo/platform/external/chromium_org/third_party/icuyazuo/platform/external/chromium_org/third_party/leveldatabase/srcyazuo/platform/external/chromium_org/third_party/libjingle/source/talkyazuo/platform/external/chromium_org/third_party/libphonenumber/src/phonenumbersyazuo/platform/external/chromium_org/third_party/libphonenumber/src/resourcesyazuo/platform/external/chromium_org/third_party/mesa/srcyazuo/platform/external/chromium_org/third_party/opensslyazuo/platform/external/chromium_org/third_party/opus/srcyazuo/platform/external/chromium_org/third_party/otsyazuo/platform/external/chromium_org/third_party/skia/gypyazuo/platform/external/chromium_org/third_party/skia/includeyazuo/platform/external/chromium_org/third_party/skia/srcyazuo/platform/external/chromium_org/third_party/smhasher/srcyazuo/platform/external/chromium_org/third_party/yasm/source/patched-yasmyazuo/platform/external/chromium_org/tools/grityazuo/platform/external/chromium_org/tools/gypyazuo/platform/external/chromium_org/v8yazuo/platform/external/clangyazuo/platform/external/compiler-rtyazuo/platform/external/dexmakeryazuo/platform/external/dhcpcdyazuo/platform/external/dnsmasqyazuo/platform/external/doclavayazuo/platform/external/dropbearyazuo/platform/external/droiddriveryazuo/platform/external/e2fsprogsyazuo/platform/external/easymockyazuo/platform/external/eclipse-basebuilderyazuo/platform/external/eclipse-windowbuilderyazuo/platform/external/eigenyazuo/platform/external/elfutilsyazuo/platform/external/embunityazuo/platform/external/emmayazuo/platform/external/esdyazuo/platform/external/expatyazuo/platform/external/eyes-freeyazuo/platform/external/fdlibmyazuo/platform/external/flacyazuo/platform/external/freetypeyazuo/platform/external/fsck_msdosyazuo/platform/external/ganymed-ssh2yazuo/platform/external/gcc-demangleyazuo/platform/external/genext2fsyazuo/platform/external/giflibyazuo/platform/external/google-diff-match-patchyazuo/platform/external/grubyazuo/platform/external/gtestyazuo/platform/external/guavayazuo/platform/external/hamcrestyazuo/platform/external/harfbuzzyazuo/platform/external/harfbuzz_ngyazuo/platform/external/hyphenationyazuo/platform/external/icu4cyazuo/platform/external/iproute2yazuo/platform/external/ipsec-toolsyazuo/platform/external/iptablesyazuo/platform/external/iputilsyazuo/platform/external/LaunchPPPoeyazuo/platform/external/libifaddrsyazuo/platform/external/pppoeyazuo/platform/external/javasqliteyazuo/platform/external/javassistyazuo/platform/external/jdiffyazuo/platform/external/jheadyazuo/platform/external/jmdnsyazuo/platform/external/jmonkeyengineyazuo/platform/external/jpegyazuo/platform/external/jsilveryazuo/platform/external/jsr305yazuo/platform/external/junityazuo/platform/external/kernel-headersyazuo/platform/external/libcap-ngyazuo/platform/external/libffiyazuo/platform/external/libgsmyazuo/platform/external/liblzfyazuo/platform/external/libmtpyazuo/platform/external/libnfc-nciyazuo/platform/external/libnfc-nxpyazuo/platform/external/libnl-headersyazuo/platform/external/liboggyazuo/platform/external/libpcapyazuo/platform/external/libphonenumberyazuo/platform/external/libpngyazuo/platform/external/libpppyazuo/platform/external/libselinuxyazuo/platform/external/libsepolyazuo/platform/external/libusbyazuo/platform/external/libusb-compatyazuo/platform/external/libvorbisyazuo/platform/external/libvpxyazuo/platform/external/libxml2yazuo/platform/external/libxsltyazuo/platform/external/libyuvyazuo/platform/external/linux-tools-perfyazuo/platform/external/littlemockyazuo/platform/external/wide-dhcpv6yazuo/platform/external/llvmyazuo/platform/external/lzmayazuo/platform/external/marisa-trieyazuo/platform/external/markdownyazuo/platform/external/mdnsresponderyazuo/platform/external/mesa3dyazuo/platform/external/mkshyazuo/platform/external/mockitoyazuo/platform/external/mockwebserveryazuo/platform/external/mp4parseryazuo/platform/external/mtpdyazuo/platform/external/naver-fontsyazuo/platform/external/netcatyazuo/platform/external/netperfyazuo/platform/external/nevenyazuo/platform/external/nist-pkitsyazuo/platform/external/nist-sipyazuo/platform/external/noto-fontsyazuo/platform/external/oauthyazuo/platform/external/objenesisyazuo/platform/external/okhttpyazuo/platform/external/open-vcdiffyazuo/platform/external/opencvyazuo/platform/external/openfstyazuo/platform/external/opensshyazuo/platform/external/opensslyazuo/platform/external/oprofileyazuo/platform/external/pixmanyazuo/platform/external/pppyazuo/platform/external/proguardyazuo/platform/external/protobufyazuo/platform/external/qemuyazuo/platform/external/qemu-pc-biosyazuo/platform/external/regex-re2yazuo/platform/external/replicaislandyazuo/platform/external/robolectricyazuo/platform/external/safe-iopyazuo/platform/external/scryptyazuo/platform/external/sepolicyyazuo/platform/external/sfntlyyazuo/platform/external/sil-fontsyazuo/platform/external/skiayazuo/platform/external/smackyazuo/platform/external/smaliyazuo/platform/external/sonivoxyazuo/platform/external/speexyazuo/platform/external/sqliteyazuo/platform/external/srecyazuo/platform/external/srtpyazuo/platform/external/stlportyazuo/platform/external/straceyazuo/platform/external/stressapptestyazuo/platform/external/svoxyazuo/platform/external/tagsoupyazuo/platform/external/tcpdumpyazuo/platform/external/timezonepicker-supportyazuo/platform/external/tinyalsayazuo/platform/external/tinycompressyazuo/platform/external/tinyxmlyazuo/platform/external/tinyxml2yazuo/platform/external/tremoloyazuo/platform/external/v8yazuo/platform/external/valgrindyazuo/platform/external/webpyazuo/platform/external/webrtcyazuo/platform/external/wpa_supplicant_8yazuo/platform/external/xmlwriteryazuo/platform/external/xmp_toolkityazuo/platform/external/yaffs2yazuo/platform/external/zlibyazuo/platform/external/zxingyazuo/platform/frameworks/avyazuo/platform/frameworks/baseyazuo/platform/frameworks/compile/libbccyazuo/platform/frameworks/compile/mclinkeryazuo/platform/frameworks/compile/slangyazuo/platform/frameworks/exyazuo/platform/frameworks/mlyazuo/platform/frameworks/bluetoothyazuo/platform/frameworks/nativeyazuo/platform/frameworks/opt/calendaryazuo/platform/frameworks/opt/colorpickeryazuo/platform/frameworks/opt/datetimepickeryazuo/platform/frameworks/opt/emojiyazuo/platform/frameworks/opt/inputmethodcommonyazuo/platform/frameworks/opt/mailcommonyazuo/platform/frameworks/opt/mmsyazuo/platform/frameworks/opt/net/voipyazuo/platform/frameworks/opt/photovieweryazuo/platform/frameworks/opt/timezonepickeryazuo/platform/frameworks/opt/telephonyyazuo/platform/frameworks/opt/vcardyazuo/platform/frameworks/rsyazuo/platform/frameworks/supportyazuo/platform/frameworks/testingyazuo/platform/frameworks/uiautomatoryazuo/platform/frameworks/volleyyazuo/platform/frameworks/webviewyazuo/platform/frameworks/wilhelmyazuo/platform/hardware/akmyazuo/platform/hardware/broadcom/libbtyazuo/platform/hardware/broadcom/wlanyazuo/platform/hardware/invensenseyazuo/platform/hardware/libhardwareyazuo/platform/hardware/libhardware_legacyyazuo/platform/hardware/qcom/audioyazuo/platform/hardware/qcom/btyazuo/platform/hardware/qcom/camerayazuo/platform/hardware/qcom/displayyazuo/platform/hardware/qcom/keymasteryazuo/platform/hardware/qcom/mediayazuo/platform/hardware/qcom/msm8960yazuo/platform/hardware/qcom/msm8x74yazuo/platform/hardware/qcom/poweryazuo/platform/hardware/qcom/wlanyazuo/platform/hardware/rilyazuo/platform/hardware/samsung_slsi/exynos5yazuo/platform/hardware/ti/omap3yazuo/platform/hardware/ti/omap4xxxyazuo/platform/hardware/ti/wlanyazuo/platform/hardware/ti/wpanyazuo/platform/libcoreyazuo/platform/libnativehelperyazuo/platform/ndkyazuo/kernelyazuo/mediatekyazuo/vendoryazuo/platform/packages/providers/DrmProvideryazuo/platform/packages/apps/DeviceTestAppyazuo/platform/packages/apps/BasicSmsReceiveryazuo/platform/packages/apps/Bluetoothyazuo/platform/packages/apps/Browseryazuo/platform/packages/apps/Calculatoryazuo/platform/packages/apps/Calendaryazuo/platform/packages/apps/Camerayazuo/platform/packages/apps/Camera2yazuo/platform/packages/apps/CellBroadcastReceiveryazuo/platform/packages/apps/CertInstalleryazuo/platform/packages/apps/Contactsyazuo/platform/packages/apps/ContactsCommonyazuo/platform/packages/apps/DeskClockyazuo/platform/packages/apps/Dialeryazuo/platform/packages/apps/Emailyazuo/platform/packages/apps/Exchangeyazuo/platform/packages/apps/Galleryyazuo/platform/packages/apps/Gallery2yazuo/platform/packages/apps/HTMLVieweryazuo/platform/packages/apps/InCallUIyazuo/platform/packages/apps/KeyChainyazuo/platform/packages/apps/Launcher2yazuo/platform/packages/apps/Launcher3yazuo/platform/packages/apps/LegacyCamerayazuo/platform/packages/apps/Mmsyazuo/platform/packages/apps/Musicyazuo/platform/packages/apps/MusicFXyazuo/platform/packages/apps/Nfcyazuo/platform/packages/apps/OneTimeInitializeryazuo/platform/packages/apps/PackageInstalleryazuo/platform/packages/apps/PhoneCommonyazuo/platform/packages/apps/Protipsyazuo/platform/packages/apps/Provisionyazuo/platform/packages/apps/QuickSearchBoxyazuo/platform/packages/apps/Settingsyazuo/platform/packages/apps/SoundRecorderyazuo/platform/packages/apps/SparePartsyazuo/platform/packages/apps/SpeechRecorderyazuo/platform/packages/apps/Stkyazuo/platform/packages/apps/Tagyazuo/platform/packages/apps/UnifiedEmailyazuo/platform/packages/apps/VideoEditoryazuo/platform/packages/apps/VoiceDialeryazuo/platform/packages/experimentalyazuo/platform/packages/inputmethods/LatinIMEyazuo/platform/packages/inputmethods/OpenWnnyazuo/platform/packages/inputmethods/PinyinIMEyazuo/platform/packages/providers/ApplicationsProvideryazuo/platform/packages/providers/CalendarProvideryazuo/platform/packages/providers/ContactsProvideryazuo/platform/packages/providers/DownloadProvideryazuo/platform/packages/providers/MediaProvideryazuo/platform/packages/providers/PartnerBookmarksProvideryazuo/platform/packages/providers/TelephonyProvideryazuo/platform/packages/providers/UserDictionaryProvideryazuo/platform/packages/screensavers/Basicyazuo/platform/packages/screensavers/PhotoTableyazuo/platform/packages/screensavers/WebViewyazuo/platform/packages/services/Telephonyyazuo/platform/packages/wallpapers/Basicyazuo/platform/packages/wallpapers/Galaxy4yazuo/platform/packages/wallpapers/HoloSpiralyazuo/platform/packages/wallpapers/LivePickeryazuo/platform/packages/wallpapers/MagicSmokeyazuo/platform/packages/wallpapers/MusicVisualizationyazuo/platform/packages/wallpapers/NoiseFieldyazuo/platform/packages/wallpapers/PhaseBeamyazuo/platform/pdkyazuo/platform/prebuilts/clang/linux-x86/3.1yazuo/platform/prebuilts/devtoolsyazuo/platform/prebuilts/eclipseyazuo/platform/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.6yazuo/platform/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.7yazuo/platform/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.6yazuo/platform/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.7yazuo/platform/prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1yazuo/platform/prebuilts/gcc/darwin-x86/mips/mipsel-linux-android-4.6yazuo/platform/prebuilts/gcc/darwin-x86/mips/mipsel-linux-android-4.7yazuo/platform/prebuilts/gcc/darwin-x86/x86/i686-linux-android-4.6yazuo/platform/prebuilts/gcc/darwin-x86/x86/i686-linux-android-4.7yazuo/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6yazuo/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7yazuo/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6yazuo/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7yazuo/platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.4.3yazuo/platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6yazuo/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6yazuo/platform/prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.6yazuo/platform/prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.7yazuo/platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.6yazuo/platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7yazuo/platform/prebuilts/miscyazuo/platform/prebuilts/ndkyazuo/platform/prebuilts/python/darwin-x86/2.7.5yazuo/platform/prebuilts/python/linux-x86/2.7.5yazuo/platform/prebuilts/qemu-kernelyazuo/platform/prebuilts/runtimeyazuo/platform/prebuilts/sdkyazuo/platform/prebuilts/toolsyazuo/platform/sdkyazuo/platform/system/mobile_toolkityazuo/platform/system/coreyazuo/platform/system/extrasyazuo/platform/system/mediayazuo/platform/system/netdyazuo/platform/system/securityyazuo/platform/system/voldyazuo/platform/tools/external/fat32libyazuo/platform/tools/external/gradleyazuo/platform/tools/idea
3)編寫初始化源碼倉庫腳本server_create.sh
vim server_create.sh添加
#/bin/bashset-xset-epwd=${PWD}cd/home/gitolite/repositorieswhilereadline;doif[ -z"$line"];thenechowork_dir not exist !!!1>&2continuefigit init --bare$line.gitecho====$linepwddone
4)初始化空的源碼倉庫
【在服務(wù)器上使用gitolite用戶操作】
cat server.txt | ./server_create.sh
5)生成client.txt
使用 cat default.xml | cut -d ‘”’ -f 2 > client.txt
生成client.txt惰赋,將無關(guān)的字符刪除
-1.0--yazuo-..-ssh-master-yazuo-1-core/root.mk--
得到一個本地客戶端倉庫路徑的文本 client.txt
buildabi/cppartbionicbootable/bootloader/lkbootable/diskinstallerbootable/recoveryctsdalvikdevelopers/builddevelopers/samples/androiddevelopmentdevice/asus/debdevice/asus/flodevice/asus/flo-kerneldevice/asus/grouperdevice/asus/tilapiadevice/commondevice/generic/armv7-a-neondevice/generic/commondevice/generic/goldfishdevice/generic/mipsdevice/generic/mini-emulator-armv7-a-neondevice/generic/mini-emulator-mipsdevice/generic/mini-emulator-x86device/generic/x86device/google/accessory/arduinodevice/google/accessory/demokitdevice/lge/hammerheaddevice/lge/hammerhead-kerneldevice/lge/makodevice/lge/mako-kerneldevice/sampledevice/samsung/mantadocs/source.android.comexternal/aacexternal/android-clatexternal/android-mockexternal/ant-globexternal/antlrexternal/apache-harmonyexternal/apache-httpexternal/apache-xmlexternal/arduinoexternal/bisonexternal/blktraceexternal/bluetooth/bluedroidexternal/bouncycastleexternal/bsdiffexternal/bzip2external/ceres-solverexternal/checkpolicyexternal/chromiumexternal/chromium-libpacexternal/chromium-traceexternal/chromium_orgexternal/chromium_org/sdch/open-vcdiffexternal/chromium_org/testing/gtestexternal/chromium_org/third_party/WebKitexternal/chromium_org/third_party/angle_dx11external/chromium_org/third_party/eyesfree/src/android/java/src/com/googlecode/eyesfree/brailleexternal/chromium_org/third_party/freetypeexternal/chromium_org/third_party/icuexternal/chromium_org/third_party/leveldatabase/srcexternal/chromium_org/third_party/libjingle/source/talkexternal/chromium_org/third_party/libphonenumber/src/phonenumbersexternal/chromium_org/third_party/libphonenumber/src/resourcesexternal/chromium_org/third_party/mesa/srcexternal/chromium_org/third_party/opensslexternal/chromium_org/third_party/opus/srcexternal/chromium_org/third_party/otsexternal/chromium_org/third_party/skia/gypexternal/chromium_org/third_party/skia/includeexternal/chromium_org/third_party/skia/srcexternal/chromium_org/third_party/smhasher/srcexternal/chromium_org/third_party/yasm/source/patched-yasmexternal/chromium_org/tools/gritexternal/chromium_org/tools/gypexternal/chromium_org/v8external/clangexternal/compiler-rtexternal/dexmakerexternal/dhcpcdexternal/dnsmasqexternal/doclavaexternal/dropbearexternal/droiddriverexternal/e2fsprogsexternal/easymockexternal/eclipse-basebuilderexternal/eclipse-windowbuilderexternal/eigenexternal/elfutilsexternal/embunitexternal/emmaexternal/esdexternal/expatexternal/eyes-freeexternal/fdlibmexternal/flacexternal/freetypeexternal/fsck_msdosexternal/ganymed-ssh2external/gcc-demangleexternal/genext2fsexternal/giflibexternal/google-diff-match-patchexternal/grubexternal/gtestexternal/guavaexternal/hamcrestexternal/harfbuzzexternal/harfbuzz_ngexternal/hyphenationexternal/icu4cexternal/iproute2external/ipsec-toolsexternal/iptablesexternal/iputilsexternal/LaunchPPPoeexternal/libifaddrsexternal/pppoeexternal/javasqliteexternal/javassistexternal/jdiffexternal/jheadexternal/jmdnsexternal/jmonkeyengineexternal/jpegexternal/jsilverexternal/jsr305external/junitexternal/kernel-headersexternal/libcap-ngexternal/libffiexternal/libgsmexternal/liblzfexternal/libmtpexternal/libnfc-nciexternal/libnfc-nxpexternal/libnl-headersexternal/liboggexternal/libpcapexternal/libphonenumberexternal/libpngexternal/libpppexternal/libselinuxexternal/libsepolexternal/libusbexternal/libusb-compatexternal/libvorbisexternal/libvpxexternal/libxml2external/libxsltexternal/libyuvexternal/linux-tools-perfexternal/littlemockexternal/wide-dhcpv6external/llvmexternal/lzmaexternal/marisa-trieexternal/markdownexternal/mdnsresponderexternal/mesa3dexternal/mkshexternal/mockitoexternal/mockwebserverexternal/mp4parserexternal/mtpdexternal/naver-fontsexternal/netcatexternal/netperfexternal/nevenexternal/nist-pkitsexternal/nist-sipexternal/noto-fontsexternal/oauthexternal/objenesisexternal/okhttpexternal/open-vcdiffexternal/opencvexternal/openfstexternal/opensshexternal/opensslexternal/oprofileexternal/pixmanexternal/pppexternal/proguardexternal/protobufexternal/qemuexternal/qemu-pc-biosexternal/regex-re2external/replicaislandexternal/robolectricexternal/safe-iopexternal/scryptexternal/sepolicyexternal/sfntlyexternal/sil-fontsexternal/skiaexternal/smackexternal/smaliexternal/sonivoxexternal/speexexternal/sqliteexternal/srecexternal/srtpexternal/stlportexternal/straceexternal/stressapptestexternal/svoxexternal/tagsoupexternal/tcpdumpexternal/timezonepicker-supportexternal/tinyalsaexternal/tinycompressexternal/tinyxmlexternal/tinyxml2external/tremoloexternal/v8external/valgrindexternal/webpexternal/webrtcexternal/wpa_supplicant_8external/xmlwriterexternal/xmp_toolkitexternal/yaffs2external/zlibexternal/zxingframeworks/avframeworks/baseframeworks/compile/libbccframeworks/compile/mclinkerframeworks/compile/slangframeworks/exframeworks/mlframeworks/bluetoothframeworks/nativeframeworks/opt/calendarframeworks/opt/colorpickerframeworks/opt/datetimepickerframeworks/opt/emojiframeworks/opt/inputmethodcommonframeworks/opt/mailcommonframeworks/opt/mmsframeworks/opt/net/voipframeworks/opt/photoviewerframeworks/opt/timezonepickerframeworks/opt/telephonyframeworks/opt/vcardframeworks/rsframeworks/supportframeworks/testingframeworks/uiautomatorframeworks/volleyframeworks/webviewframeworks/wilhelmhardware/akmhardware/broadcom/libbthardware/broadcom/wlanhardware/invensensehardware/libhardwarehardware/libhardware_legacyhardware/qcom/audiohardware/qcom/bthardware/qcom/camerahardware/qcom/displayhardware/qcom/keymasterhardware/qcom/mediahardware/qcom/msm8960hardware/qcom/msm8x74hardware/qcom/powerhardware/qcom/wlanhardware/rilhardware/samsung_slsi/exynos5hardware/ti/omap3hardware/ti/omap4xxxhardware/ti/wlanhardware/ti/wpanlibcorelibnativehelperndkkernelmediatekvendorpackages/providers/DrmProviderpackages/apps/DeviceTestApppackages/apps/BasicSmsReceiverpackages/apps/Bluetoothpackages/apps/Browserpackages/apps/Calculatorpackages/apps/Calendarpackages/apps/Camerapackages/apps/Camera2packages/apps/CellBroadcastReceiverpackages/apps/CertInstallerpackages/apps/Contactspackages/apps/ContactsCommonpackages/apps/DeskClockpackages/apps/Dialerpackages/apps/Emailpackages/apps/Exchangepackages/apps/Gallerypackages/apps/Gallery2packages/apps/HTMLViewerpackages/apps/InCallUIpackages/apps/KeyChainpackages/apps/Launcher2packages/apps/Launcher3packages/apps/LegacyCamerapackages/apps/Mmspackages/apps/Musicpackages/apps/MusicFXpackages/apps/Nfcpackages/apps/OneTimeInitializerpackages/apps/PackageInstallerpackages/apps/PhoneCommonpackages/apps/Protipspackages/apps/Provisionpackages/apps/QuickSearchBoxpackages/apps/Settingspackages/apps/SoundRecorderpackages/apps/SparePartspackages/apps/SpeechRecorderpackages/apps/Stkpackages/apps/Tagpackages/apps/UnifiedEmailpackages/apps/VideoEditorpackages/apps/VoiceDialerpackages/experimentalpackages/inputmethods/LatinIMEpackages/inputmethods/OpenWnnpackages/inputmethods/PinyinIMEpackages/providers/ApplicationsProviderpackages/providers/CalendarProviderpackages/providers/ContactsProviderpackages/providers/DownloadProviderpackages/providers/MediaProviderpackages/providers/PartnerBookmarksProviderpackages/providers/TelephonyProviderpackages/providers/UserDictionaryProviderpackages/screensavers/Basicpackages/screensavers/PhotoTablepackages/screensavers/WebViewpackages/services/Telephonypackages/wallpapers/Basicpackages/wallpapers/Galaxy4packages/wallpapers/HoloSpiralpackages/wallpapers/LivePickerpackages/wallpapers/MagicSmokepackages/wallpapers/MusicVisualizationpackages/wallpapers/NoiseFieldpackages/wallpapers/PhaseBeampdkprebuilts/clang/linux-x86/3.1prebuilts/devtoolsprebuilts/eclipseprebuilts/gcc/darwin-x86/arm/arm-eabi-4.6prebuilts/gcc/darwin-x86/arm/arm-eabi-4.7prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.6prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.7prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1prebuilts/gcc/darwin-x86/mips/mipsel-linux-android-4.6prebuilts/gcc/darwin-x86/mips/mipsel-linux-android-4.7prebuilts/gcc/darwin-x86/x86/i686-linux-android-4.6prebuilts/gcc/darwin-x86/x86/i686-linux-android-4.7prebuilts/gcc/linux-x86/arm/arm-eabi-4.6prebuilts/gcc/linux-x86/arm/arm-eabi-4.7prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.4.3prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.6prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.7prebuilts/gcc/linux-x86/x86/i686-linux-android-4.6prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7prebuilts/miscprebuilts/ndkprebuilts/python/darwin-x86/2.7.5prebuilts/python/linux-x86/2.7.5prebuilts/qemu-kernelprebuilts/runtimeprebuilts/sdkprebuilts/toolssdksystem/mobile_toolkitsystem/coresystem/extrassystem/mediasystem/netdsystem/securitysystem/voldtools/external/fat32libtools/external/gradletools/idea
6)編寫初始化源碼倉庫腳本client_create.sh
vim client_create.sh 添加:
①適用于不帶任何 .git 或者.svn 的純凈Android 源碼
#/bin/bashset-xset-epwd=${PWD}whilereadline; doline1=${line%%/*}if[ -z"$line"];thenechowork_dir not exist !!!1>&2continuefiif[ $(ls -A$pwd/$line| wc-l)-eq0];thenechowork_dir empty !!!1>&2continuefiworkdir=$pwd/$lineecho====$workdircd$workdirrm -rf .git? ? git init .1>&2git add .-f1>&2git commit -m"Initial commit"1>&2if["$line1"="device"];thengit push --set-upstream git://192.168.100.249/yazuo/$line.git masterelif["$line1"="kernel"];thengit push --set-upstream git://192.168.100.249/yazuo/$line.git masterelif["$line1"="mediatek"];thengit push --set-upstream git://192.168.100.249/yazuo/$line.git masterelif["$line1"="vendor"];thengit push --set-upstream git://192.168.100.249/yazuo/$line.git masterelsegit push --set-upstream git://192.168.100.249/yazuo/platform/$line.git masterficd-done
②適合本身已有.git的android源碼
#/bin/bashset-xset-epwd=${PWD}whilereadline;doline1=${line%%/*}if[ -z"$line"];thenechowork_dir not exist !!!1>&2continuefiif[ $(ls -A$pwd/$line| wc-l)-eq0];thenechowork_dir empty !!!1>&2continuefiworkdir=$pwd/$lineecho====$workdircd$workdirgit checkout -B master yazuo/masterif["$line1"="device"];thengit push --set-upstream git://192.168.100.249/yazuo/$line.git masterelif["$line1"="kernel"];thengit push --set-upstream git://192.168.100.249/yazuo/$line.git masterelif["$line1"="mediatek"];thengit push --set-upstream git://192.168.100.249/yazuo/$line.git masterelif["$line1"="vendor"];thengit push --set-upstream git://192.168.100.249/yazuo/$line.git masterelsegit push --set-upstream git://192.168.100.249/yazuo/platform/$line.git masterficd-done
注意:
①之前寫成了
git push --set-upstreamgitolite://192.168.100.249/yazuo/platform/$line.git master
報錯:fatal: Unable to find remote helper for ‘gitolite’宰掉。犯了低級錯誤引以為戒呵哨!
②還有寫成了
gitpush--set-upstream ssh://gitolite@192.168.100.249/yazuo/platform/$line.gitmaster
也不行,這樣寫需要把所有的git工程都加到gitolite-admin/gitolite.conf文件中太麻煩轨奄!
7)初始化本地源碼倉庫孟害,并推送到遠(yuǎn)程服務(wù)器倉庫
【在xia私鑰計算機上操作】
在本地android源碼目錄下執(zhí)行下面命令:
cat client.txt| ./client_create.sh
耐心等待半小時左右,這樣就把本地Android源碼推送到服務(wù)器端的倉庫中了挪拟。至此挨务,服務(wù)器上的android源碼版本庫已經(jīng)完全OK!
4.使用repo下載服務(wù)器上的android源碼
(1)下載 git-repo
【在xia私鑰計算機上操作】
在/home/xia目錄下執(zhí)行:
git clone https://gerrit.googlesource.com/git-repo git-repo.git
如果上面的地址不行,自己就在網(wǎng)上搜一個可以下載的玉组。
cdgit-repo.git vim repo
修改 repo
REPO_URL ='https://gerrit.googlesource.com/git-repo'REPO_REV ='stable'改為 REPO_URL =/home/xia/git-repo.git? REPO_REV ='master'
1)REPO_URL 指的是 repo 所調(diào)用和管理引用倉庫
2)REPO_REV 指的是倉庫分支耘子,進入git-repo.git, 使用命令:git branch 查看球切,我的是 master 分支谷誓。
(2)將 git-repo.git 目錄下的 repo 拷貝到 ~/bin/
mkdir~/bin
cp repo ~/bin/
chmod 777 ~/bin/repo
(3)測試下載源碼
cd~/mkdir yazuotestcdyazuotestrepo init -u git://192.168.100.249/manifest.gitrepo sync
注意:可以用 -b 參數(shù)來指定某個manifest 分支。
repo init-ugit://192.168.100.249/manifest.git -b master
等待同步完成吨凑,大功告成:赐帷!鸵钝!