Hi.
Today I would like to show you how to use github. I'm not an expert (I'm rather n00b TBH ) but I learned some things and might help you with simple git commands.
1. Github? What's that?
In short it's the web-based hosting service for software development projects that use the Git revision control system. In English - the place where you store your sources.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
2. Creating an account.
2.0 Download the required libs
Code:
sudo apt-get install git
2.1 Create an account on github.com website
2.2 In terminal type:
Code:
git config --global user.name "Your Name Here"
git config --global user.email "[email protected]"
NOTE: use the e-mail used in the website account creation
2.3 Create your unique SSH public key
Code:
ssh-keygen -t rsa -C "[email protected]"
# Creates a new ssh key using the provided email
# Generating public/private rsa key pair.
# Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter]
Now you need to enter a passphrase.
Code:
# Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]
Which should give you something like this:
Code:
# Your identification has been saved in /c/Users/you/.ssh/id_rsa.
# Your public key has been saved in /c/Users/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db [email protected]
Now go to ~/.ssh folder and copy your id_rsa.pub content into account administration on github.com
... and check if everything works
Code:
ssh -T [email protected]
Code:
The authenticity of host 'github.com (207.97.227.239)' can't be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?
Duh?! Sure I want! Yes! Yes! Yessss!
Code:
# Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.
And we are ready to do some serious things! :highfive:
3. Forking a repo
As an example I'll use https://github.com/CyanogenMod/android_packages_apps_Settings
Open this link in the browser and click fork.
3.1 Clone the source from your fork.
I use my account as an example.
Code:
git clone git://github.com/eagleeyetom/android_packages_apps_Settings.git -b gingerbread
-b gingerbread let us to choose what branch are we going to download
3.2 Do some changes!
For example add files, remove them etc.
3.3 Commit the changes
OPTIONAL I created new branch at my project and named it "xda"
To do this go to the cloned folder and type:
Code:
git branch xda
git checkout xda
Now it's time to see what's going on:
Magic command
Code:
git status
As you can see I removed few files and added one.
Now it's time to tell the git what we want to do.
4. Pushing the changes
Add all modified files:
Code:
git add .
Add all removed files
Code:
git add -u
You can also add/rm one file
Code:
git add name_of_file
git rm name_of_file
After git status we should get something like this:
Now it's time to commit:
Code:
git commit -m 'my first commit'
And finally to push:
Code:
git push
If you'll get some errors use the following:
Code:
git push [email protected]:eagleeyetom/android_packages_apps_Settings.git xda
I used the name of my github and the name of the branch in the end.
Woo hoo! Now let's check the website.
That's the most basic basics
In the next posts I will show you some more advanced commands like merge, cherry-pick, removing branches etc.
Credits:
Google
Github Team
All my friends from GingerDX IRC channel
If you find it useful hit thanks button. You can also consider a small donation
5. Removing branch.
This one took me a lot of googleing and many bad words has been said
I'll make a test branch 'deleteme'
Code:
git branch deleteme
git checkout deleteme
git push [email protected]:eagleeyetom/android_packages_apps_Settings.git deleteme
And I have new remote branch now.
But I want to delete it.
Here's the answer.
First:
Check the branches:
Code:
git branch -a
And I'll get:
Code:
remotes/origin/HEAD -> origin/gingerbread
remotes/origin/deleteme
remotes/origin/donut
remotes/origin/eclair
remotes/origin/froyo
remotes/origin/froyo-stable
remotes/origin/gb-release-7.2
remotes/origin/gingerbread
remotes/origin/gingerbread-release
remotes/origin/ics
remotes/origin/icsify
remotes/origin/wip
remotes/origin/xda
I want to delete this branch.
Type:
Code:
git branch -rd origin/deleteme
# Deleted remote branch origin/deleteme (was 808ffbb).
Code:
git push [email protected]:eagleeyetom/android_packages_apps_Settings.git :refs/heads/deleteme
And the remote branch is gone! Yeah!
6. Merging the commits
Imagine the situation that you want to add a commits created by someone else. Let's use our great Recognized Developer nobodyAtall
We need to add the source:
Code:
git remote add upstream https://github.com/MiniCM/android_packages_apps_Settings.git
Download the branch:
Code:
git fetch upstream
Code:
* [new branch] cm-9.0.0 -> upstream/cm-9.0.0
* [new branch] donut -> upstream/donut
* [new branch] eclair -> upstream/eclair
* [new branch] froyo -> upstream/froyo
* [new branch] froyo-stable -> upstream/froyo-stable
* [new branch] gb-release-7.2 -> upstream/gb-release-7.2
* [new branch] gingerbread -> upstream/gingerbread
* [new branch] gingerbread-release -> upstream/gingerbread-release
* [new branch] ics -> upstream/ics
* [new branch] jellybean -> upstream/jellybean
* [new branch] master -> upstream/master
* [new branch] wip -> upstream/wip
You'll get a message to resolve the conflicts. In short and most n00b friendly way is to open pointed files and delete the:
<<<<<<<<
=======
>>>>>>>>
symbols.
Don't forget to test make before pushing!
Now standard procedure:
Code:
git add .
git commit -m 'test merge'
git push [email protected]:eagleeyetom/android_packages_apps_Settings.git xda
7. Cherry-pick the single commit
Now it's time to add specific commit to our build. I'm going to use this one.
Code:
git remote add upstream https://github.com/MiniCM/android_packages_apps_Settings.git
git fetch upstream
git cherry-pick c95854e8c91ec279bd3719c637f531491855278a
And we're good :highfive:
Now commit should be added. All you need now is to push - no need to commit
8. Changing the branch
While using git you may noticed that sometimes after fresh sync there is no branch selected. Imagine the situation when you are on a branch A and want to check to branch B, because it uses a different method (like framework patch etc.)
The solution is pretty simple.
Code:
git checkout -t remote_name/remote_branch
It allows you to change the branch to remote one without cloning the whole repo again.
Pull request
If you feel that you have fixed a problem and want to help the developer to make his own ROM/kernel etc. you should consider to make a pull request. Pull request adds the changes you have made to the others repo.
First of all.
Fork and clone destined repo.
Check the previous post about forking and cloning.
Now make some changes and upload it to your own remote git.
Then, go to your forked repo using browser and click on Pull request.
Then choose the account and branch to pull-request.
Click and wait for your request to be merged
Merging a pull request.
Sometimes someone wants to add something to your code.
You'll be notified by e-mail and also see the notification on your github website.
Go there and click Open
When the changes can't be merged you'll see such message:
But when it's green, you are ready to merge it
Don't forget to review the code. In other way you'll be forced to delete the commit.
You can also use text method:
Code:
git checkout master
[COLOR="DeepSkyBlue"]# Check out your master branch[/COLOR]
git remote add TeamFun git://github.com/TeamFun/android_packages_apps_Settings.git
[COLOR="deepskyblue"]# Add a new remote named 'TeamFun'[/COLOR]
git fetch TeamFun
[COLOR="deepskyblue"]# Pull in all the commits from the 'cameronmcefee' remote[/COLOR]
git merge TeamFun/gingerbread
[COLOR="deepskyblue"]# Merge your master branch into the 'gingerbread' branch from the 'TeamFun' remote[/COLOR]
git push [email protected]:eagleeyetom/android_packages_apps_Settings.git master
[COLOR="deepskyblue"]# Push your newly-merged branch back to GitHub[/COLOR]
or
Code:
git checkout master
[COLOR="DeepSkyBlue"]# Check out your master branch[/COLOR]
$ curl http://github.com/octocat/Spoon-Knife/pull/25.patch | git am
[COLOR="deepskyblue"]# Grab the patch generated by a pull request and feed it into a new commit[/COLOR]
$ git push [email protected]:eagleeyetom/android_packages_apps_Settings.git master
[COLOR="deepskyblue"]# Push your newly-updated commit back to GitHub[/COLOR]
TIPS AND TRICKS
REVERT CHANGES
To discard all unstaged changes e.g. failed merge etc. type:
Code:
git checkout .
# to delete all changes
git checkout path/to/file
# to discard changes for a specific file
You can also use:
Code:
rm -rf ./
[COLOR="Cyan"]# deletes all of the files in the directory[/COLOR]
git reset --hard
[COLOR="cyan"]#This is going to restore the git to the previous state[/COLOR]
HOW TO REMOVE COMMITTED CHANGES?
To remove committed changes you have to revert the commit. But how to do that? It's your answer
Code:
git reset HEAD --hard
HEAD is the previous commit. To revert to previous state use HEAD~1, HEAD~2 etc. you can also use the code taken from git log.
GIT PATCH AND GIT APPLY
Now I want to make a patch file to e.g. send an e-mail with my commited changes.
First I need to find a changes made by a commit. To do this I need to know commit ID.
Code:
git log --oneline #This would show the commit ID's
Now pick the commit for example 22a95d1 and use git show to make a patch
Code:
git show 22a95d1 > patchname.patch
And I got patch, but how to apply it?
The answer is easy. Use git apply.
Code:
git apply patchname.patch
# --check checks if the patch can be applied
FORCE PUSH
Sometimes github doesn't want to cooperate - just like some people
You can force it by adding --force or -f
Code:
git push -f [email protected]:eagleeyetom/android_packages_apps_Settings.git master
n00b method to add changes after failed push.
Clone the repo and delete everything but .git directory. Then copy modified content, commit and push
guide-man funs!
Oh I needed this. Thanks EET! :good:
Thanks man really needed this !
Wow... this is also exactly what I would want! Thanks EET!
SEARCH. ASK. TEST... not the other way round! - lucastan96
Sent With My Brains To Yours
Great. Now i'll know what i'm doing wrong. :thumbup:
Please give credit where credit is due..
If you can't even search how can I help you??
Thanks bro needed this !
Wow... this is what i exactly learning too ! Thanks mate...
my current stage
repo branching and remote branching
im using merging conflict Kdiff3(downloaded from website)
Add the KDiff3 directory to your Windows System Path (e.g. C:\Program Files\KDiff3\)
Add kdiff3 as your Git mergetool (From Git Bash, run git config --global merge.tool kdiff3)
Add kdiff3 complete path to Git Config
(From Git Bash, run git config --global mergetool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe")
Go into Git GUI settings and set the mergetool to kdiff3 (if Git GUI doesn't pick up this setting from git config, which it should)
git config --global diff.tool KDiff3
git config --global difftool.KDiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global merge.tool KDiff3
git config --global mergetool.KDiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
then type,
git mergetool
it will auto bring to your Kdiff3
Great guide.......
Sent from my GT-S6102 using Tapatalk 2
Hi EET,
Auto Fix conflicts,(merging commit)
Just want to clarified do we need delete
<<<<< HEAD
||||||| merged common ancestors
>>>>> 8ffc0cf20afc8efef75564965bfd497c597df465
along with those symbols
yes <<<<<<< u8928y4283ry23r2yhrfodknvoslf
======== sru2q8w9erfhwsd
>>>>>>>>> 90u7rw9wsdhjvosdkn
Delete all of this
I'm just bumping this thread, because it was moved from X8 section
eagleeyetom said:
I'm just bumping this thread, because it was moved from X8 section
Click to expand...
Click to collapse
To the Ace forums ?
Some additional info.
1. I suggest switching to https://github.com/robbyrussell/oh-my-zsh shell.
Not only it has plugin for git but also has built in themes. Finally, auto-completion is BOSS in zsh.
Type
Code:
/u/i/c++
hit Tab and you have a full path.
Code:
/usr/include/c++
2. Just type
Code:
alias
It'll spit present aliases, some of them for git.
Nice write up, helpful
Thank you Man
Thank you bro for the tutorial, I guess that I may need this in near future.
Thanks Again !
great piece!
Well, this is out of topic, but, does anyone know of a git app / tool which works on android and is able to do commits / pushes?
Related
So I set up a chain of scripts to build, package, and deploy CyanogenMod kang builds on Ubuntu 11.04 according to the guide in this thread: http://forum.xda-developers.com/showthread.php?t=1067519
Now that I can successfully build CyanogenMod, I'm wondering what the best (quickest, easiest, etc.) way is to cherry pick changes from the CyanogenMod code review which is found here: http://review.cyanogenmod.com/#q,statuspen,n,z
For example, if I wanted to allow the user to choose whether or not to show the "Hold" button in calls, I would need to pull this change: http://review.cyanogenmod.com/#change,6104. What would be the best way of doing this?
Thanks in advance for any help!
When I try to use the git cherry-pick command found on the commit page, I get this error: "fatal: You do not have a valid HEAD"
hmmm I would
Code:
cd android/system/packages/apps/Phone/
and then do
Code:
git pull http://review.cyanogenmod.com/p/CyanogenMod/android_packages_apps_Phone refs/changes/04/6104/1
but I'm pretty new on this too.
I've been building from source for a couple of weeks now and just finished my first kernel from source but I'm having problems pulling commits.
Whenever I try to pull or cherry-pick I get
Code:
fatal: Not a git repository (or any of the parent directories): .git
Were you actually able to pull the commit? I'm doing this from android/system. Should I be in a different folder?
Try this little tutorial. ^_~
http://forum.xda-developers.com/showpost.php?p=23527685&postcount=29
The important part that I was missing was to be in the correct directory based on the patch.
For instance
Code:
cyanogenmod dot com/p/CyanogenMod/android_packages_apps_Phone refs/changes/04/6104/1
would have to be in android/packages/apps/Phone
and
Code:
cyanogenmod dot com/p/CyanogenMod/android_frameworks_base refs/changes/29/11129/8 && git checkout FETCH_HEAD
would be in android/frameworks/base
Thanks for the help on this
how do i cherry pick a single commit from a github source? like get a certain commit from aokps settings app and get it into cm10.1
i tried this and seemed to break my build
cd ~/android/system/frameworks/base
git fetch https://github.com/AOKP/packages_apps_Settings.git && cherry-pick 8b7e06fe63939730067b539ca7343fcd8e68ad01 FETCH_HEAD
is that the right way to do it? and how do i know if it cherry picked correctly? sorry im still getting the hang of thins with github
azoller1 said:
how do i cherry pick a single commit from a github source? like get a certain commit from aokps settings app and get it into cm10.1
i tried this and seemed to break my build
cd ~/android/system/frameworks/base
git fetch https://github.com/AOKP/packages_apps_Settings.git && cherry-pick 8b7e06fe63939730067b539ca7343fcd8e68ad01 FETCH_HEAD
is that the right way to do it? and how do i know if it cherry picked correctly? sorry im still getting the hang of thins with github
Click to expand...
Click to collapse
I'd go to their gerrit. Anything and find what you want.
http://gerrit.sudoservers.com/#/q/status:open,n,z
Click on it, note the Project listed. cd to that in your tree. then in the download section you see a cherry-pick tab. click that and select the command there. That is the command you use. If it comes in without needing to merge anything you are good.
thanks, and how would i know if merging is needed?
azoller1 said:
thanks, and how would i know if merging is needed?
Click to expand...
Click to collapse
it'll tell you. Not sure if you use UI or command line but in command line i installed vimdiff, then set it as git mergetool with,
git config --global merge.tool vimdiff
if using UI I'd use meld.
so it'll report something needs to be merged then just
git mergetool and it'll open up. manually fix the merge
then
git status
This will show you the .orig files. delete them
Then:
git add -A
git commit -a
Control+X(nano) or :wq (vim)
And you're done.
git remote add -f repo.git then git cherry pick commit id
so basically just get the branch i want a cherry pick from, then picks it from the branch when i enter the commit, and i need to cd in the right directory before doing
git remote add -f repo.git?
see if it help!http://forum.xda-developers.com/showthread.php?p=23527685#post23527685
yeah i saw that guide, but still confused using github, gerrit is pretty easy
I always use this thingy as reference for cherry-picking:
http://stackoverflow.com/questions/...ctively-pull-merge-changes-from-anothers-fork
sorry forgot about this i will give a better example. if you want tp cherry pick a framwork base commit be in the framework folder then
git remote add paranoid(name is irrlefvent) -f [email protected]aranoidAndroid/android_frameworks_base.git
wait for it to download
then git cherry pick the commit id: git cherry pick f9cedfe79cc1d545b920f93539a0843d02819fe6
FYI, if you are looking at a specific commit on github, you can get it in patch format by adding .patch to the URL.
For example:
https://github.com/CyanogenMod/andr...mmit/e8ba824b16a3575d9a4c5d85dce6d3800970d093
becomes
https://github.com/CyanogenMod/andr...8ba824b16a3575d9a4c5d85dce6d3800970d093.patch
If you download that .patch file, it can be applied using:
Code:
git am <patchfile>.patch
FYI, on your own machine, if you want to export such a patch for distribution, use
Code:
git format-patch
For example:
Code:
git format-patch HEAD~3
Would output the last 3 patches you committed in "git am" committable form.
FYI, this is why any developer who tells you that releasing source code for test kernels is not feasible is full of BS. It's understandable that you don't want to push test commits to a public repo, but it's perfectly feasible to meet the requirements of the GPL by providing formatted patches.
As an example: http://forum.xda-developers.com/showpost.php?p=22925793&postcount=339
Entropy512 said:
FYI, if you are looking at a specific commit on github, you can get it in patch format by adding .patch to the URL.
For example:
https://github.com/CyanogenMod/andr...mmit/e8ba824b16a3575d9a4c5d85dce6d3800970d093
becomes
https://github.com/CyanogenMod/andr...8ba824b16a3575d9a4c5d85dce6d3800970d093.patch
If you download that .patch file, it can be applied using:
Code:
git am <patchfile>.patch
FYI, on your own machine, if you want to export such a patch for distribution, use
Code:
git format-patch
For example:
Code:
git format-patch HEAD~3
Would output the last 3 patches you committed in "git am" committable form.
FYI, this is why any developer who tells you that releasing source code for test kernels is not feasible is full of BS. It's understandable that you don't want to push test commits to a public repo, but it's perfectly feasible to meet the requirements of the GPL by providing formatted patches.
As an example: http://forum.xda-developers.com/showpost.php?p=22925793&postcount=339
Click to expand...
Click to collapse
If using this method to patch, which folder in my source do I download the patch to? Also when adding commits to my source do I need to add every single commit individually or can I just choose the commit from the major header? For example there are many commits within the Frameworks folder (Frameworks/Base..etc) do I need to go into the Frameworks folder and add each element individually or can I just add the commit from the Frameworks folder? One more thing, how to I apply a patch that I have downloaded as xxx.patch? Sorry if this is hard to understand I'm new at this and still learning the jargon.
Thanks!
The truth is already out there: http://wiki.cyanogenmod.org/w/After_You_Build
http://wiki.cyanogenmod.org/w/Doc:_...building_a_patch_submission_already_on_Gerrit
Sent from my Nexus 7 using xda premium
i want this commit: https://github.com/CyanogenMod/andr...mmit/d1f1fb4064bfcef528a12a4c5176df7b44ffd48c
you need two things, the url to the main project and the commit id, both you just copy out of your browser
the branch i always use is called "jellybean"
my remote to my git is called "github"
that might differ from your configuration-
cd aosp
cd packages/app/Settings
git checkout jellybean
git remote add cyan https://github.com/CyanogenMod/android_packages_apps_Settings
git fetch cyan
git cherry-pick d1f1fb4064bfcef528a12a4c5176df7b44ffd48c
done.
in case it conflicts, you run:
grep -r "<< HEAD" .
and fix all the files it spits out. search for "<< HEAD" in these files and you should see what to do.
when you're done fixing your files you can test if it builds, if it does you go:
git add --all
git commit --all
in the end you push it up to your git
git push github jellybean
Entropy512 said:
FYI, if you are looking at a specific commit on github, you can get it in patch format by adding .patch to the URL.
For example:
https://github.com/CyanogenMod/andr...mmit/e8ba824b16a3575d9a4c5d85dce6d3800970d093
becomes
https://github.com/CyanogenMod/andr...8ba824b16a3575d9a4c5d85dce6d3800970d093.patch
If you download that .patch file, it can be applied using:
Code:
git am <patchfile>.patch
FYI, on your own machine, if you want to export such a patch for distribution, use
Code:
git format-patch
For example:
Code:
git format-patch HEAD~3
Would output the last 3 patches you committed in "git am" committable form.
FYI, this is why any developer who tells you that releasing source code for test kernels is not feasible is full of BS. It's understandable that you don't want to push test commits to a public repo, but it's perfectly feasible to meet the requirements of the GPL by providing formatted patches.
As an example: http://forum.xda-developers.com/showpost.php?p=22925793&postcount=339
Click to expand...
Click to collapse
i think this is the easiest way to pick a commit from someone and add it into your own source, but instead i used this command line in my root source
patch -p1 < ./patch
seems to fail a lot when adding the patch but its really easy to fix it
Entropy512 said:
FYI, if you are looking at a specific commit on github, you can get it in patch format by adding .patch to the URL.
For example:
https://github.com/CyanogenMod/andr...mmit/e8ba824b16a3575d9a4c5d85dce6d3800970d093
becomes
https://github.com/CyanogenMod/andr...8ba824b16a3575d9a4c5d85dce6d3800970d093.patch
If you download that .patch file, it can be applied using:
Code:
git am <patchfile>.patch
FYI, on your own machine, if you want to export such a patch for distribution, use
Code:
git format-patch
For example:
Code:
git format-patch HEAD~3
Would output the last 3 patches you committed in "git am" committable form.
FYI, this is why any developer who tells you that releasing source code for test kernels is not feasible is full of BS. It's understandable that you don't want to push test commits to a public repo, but it's perfectly feasible to meet the requirements of the GPL by providing formatted patches.
As an example: http://forum.xda-developers.com/showpost.php?p=22925793&postcount=339
Click to expand...
Click to collapse
FYI, you use a lot of `FYI` in your post lol.
Sent from my Nexus 7 using Tapatalk 4
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Welcome to the tutorial for build CyanogenMod 10 for the HTC ChaCha. This tutorial was a community based project from HTC ChaCha’s Google+. We created this tutorial to try and boost the development of the HTC ChaCha board and bring some life back to the board.
Requirements:
Linux System x64 (Ubuntu 12.04 and newer can be used)
Mac OS X can also be used, however this tutorial is designed for Linux users.
Python 2.6 -- 2.7, which you can download from python.org or with sudo apt-get install python on Ubuntu or Debian.
GNU Make 3.81 -- 3.82, which you can download from gnu.org or with sudo apt-get install make on Ubuntu or Debian.
JDK 6 (Can be found at Ubuntu Software Centre or read details in Build Environment for detailed instructions)
Git 1.7 or newer. You can find it at git-scm.com or with sudo apt-get install git-core on Ubuntu or Debian.
Good amount of RAM, less you have longer it will take to build. I recommend a 2GB and higher.
A decent ISP which provides a fast, reliable connection(so you don't timeout during a large pull of source)
Setting up a Build Environment
Follow this guide: http://source.android.com/source/initializing.html
Installing Repo
Repo is a tool that makes it easier to work with Git and Gerrit in the context of Android. To learn more about Repo and Gerrit, see Version Control.
To install, initialize, and configure Repo, follow these steps:
Make sure you have a bin/ directory in your home directory, and that it is included in your path:
Code:
$ mkdir ~/bin
$ export PATH=${PATH}:~/bin
Alternatively, experienced Linux users may wish to add PATH=${PATH}:~/bin to ~/.bashrc to avoid re-typing the export command.
Download the Repo script and ensure it is executable:
Code:
$ curl [url]https://dl-ssl.google.com/dl/googlesource/git-repo/repo[/url] > ~/bin/repo
$ chmod a+x ~/bin/repo
Initializing a Repo client
After installing Repo, set up your client to access the android source repository
Create an empty directory to hold your working files, please note that Linux’s files system is case-sensitive so uppercase letters matter. Give it any name you like, we’ve used WORKING_DIRECTORY for a quick example:
Code:
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
Run repo init to bring down the latest version of Repo with all of its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source will be placed within your working directory and where to download them from. The manifest will update automatically when minor versions of Android are released (4.1.x) but not when major versions are (4.X). A major version can only be changed by selecting the new branch codename with the -b flag bellow.
Code:
$ repo init -u git://github.com/CyanogenMod/android.git -b jellybean
When prompted, please configure Repo with your real name and email address. To download AOSP material, you will need an email address that is connected with a registered Google account. Make sure this is a live address at which you can receive messages as the name that you provide here will show up in attributions for your code submissions. You won’t get any messages if you don’t submit any code.
A successful initialization will end with a message stating that Repo is initialized in your working directory. Your client directory should now contain a .repo directory where files such as the manifest will be kept.
Getting the files
To pull down files to your working directory from the repositories as specified in the default manifest, run
Code:
$ repo sync -j8 WORKING_DIRECTORY
Note: The “-j8” is dependent on your internet connection. If you have a slower and fragile then use a lower number like “j2” for example.
The Android source files will be located in your working directory under their project names. The initial sync operation will take an hour or more to complete. For more about repo sync and other Repo commands, see Version Control.
The repo sync operation will take a lot of time (JB source are about 14 GB!). Make sure no other people will be using your system and then pull the source, recommend pulling during the night. However if your source does get interrupted then you can continue the source pulling by running the command again, however this is not recommended.
Using authentication
By default, access to the Android source code is anonymous. To protect the servers against excessive usage, each IP address is associated with a quota.
When sharing an IP address with other users (e.g. when accessing the source repositories from beyond a NAT firewall), the quotas can trigger even for regular usage patterns (e.g. if many users sync new clients from the same IP address within a short period).
In that case, it is possible to use authenticated access, which then uses a separate quota for each user, regardless of the IP address.
The first step is to create a password from the password generator and to save it in ~/.netrc according to the instructions on that page.
The second step is to force authenticated access, by using the following manifest URI:
Code:
[url]https://android.googlesource.com/a/platform/manifest[/url]
Notice how the /a/ directory prefix triggers mandatory authentication.
You can convert an existing client to use mandatory authentication with the following command:
Code:
$ repo init -u [url]https://android.googlesource.com/a/platform/manifest[/url]
To build for the HTC ChaCha you will need to include the specific repository’s for the device. This includes the device files, vendor files and other important repos which are needed:
Device Tree: https://github.com/adumont/android_device_htc_chacha
Vendor Tree: https://github.com/adumont/android_vendor_htc_chacha
Kernel sources: https://github.com/adumont/htc-kernel-msm7227
Click to expand...
Click to collapse
Note: The maintainer of the source is adlx, feel free to fork the projects (if you need to modify them), but if you fix bugs, please submit a pull request (via Github). To clone the project locally on your hard-drive and modify locally you don’t need to either register at Github nor fork the repos.
Open a terminal (Ctrl+Alt+T) and run the following lines:
Code:
$ cd WORKING_DIRECTORY
$ wget -O .repo/local_manifest.xml
[url]https://github.com/adumont/android_device_htc_chacha/blob/jellybean/extra/local_manifest.xml[/url]
$ repo sync -j8 -c
This will download the needed additional repositories to build Jellybean (CM10) for the HTC ChaCha.
Once you're all set up we can start building. If you're not already in the Terminal, open it up again and navigate to your working directory. Run these following commands to start compiling!
Code:
$ . build/envsetup.sh
$ lunch cm_chacha-eng
$ mka bacon
Note: Where “x” is, number how many jobs you want the compile to complete in a second. Remember that this is dependent on your machine. If you have a low spec computer use “-j1” for example.
This last sentence will initiate the build process, which can take several hours depending of your hardware configuration. Once complete the build system will display where the flashable item is stored. Commonly the file can be found below.
Code:
$ cd out/target/product/chacha/
$ ls *.zip
Troubleshooting network issues
When downloading from behind a proxy (which is common in some corporate environments), it might be necessary to explicitly specify the proxy that is then used by repo:
Code:
$ export HTTP_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
$ export HTTPS_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
NOTE: Rarely, Linux clients experience connectivity issues, getting stuck in the middle of downloads (typically during "Receiving objects"). It has been reported that tweaking the settings of the TCP/IP stack and using non-parallel commands can improve the situation. You need root access to modify the TCP setting:
Code:
$ sudo sysctl -w net.ipv4.tcp_window_scaling=0
$ repo sync -j1
E: Your download during the source pulling stopped or it got interrupted. What’s should I do?
A: Use the same command “repo sync” and your download will be resumed. However the will be a small chance of corruption depending on your situation.
E: make: *** No rule to make target `#######', needed by `out/target/product/chacha/obj/SHARED_LIBRARIES/######'. Stop.
make: *** Waiting for unfinished jobs....
A: Usually this occurs when you have an incorrect file or a corrupted file (which can’t be found) which ChaCha device folder is requesting. Use CyanogenMod’s Github to find the correct file or find it using Google.
Question and Answers
What if I don’t want to build CyanogenMod?
You don’t have to. It is possible to build AOKP, Paranoid Android and so on for the HTC ChaCha. Apart from you need to work through the issues and errors. How to build AOKP will be added to this tutorial soon.
My build has some issues!
Report your issue on this thread and someone may help you. If your not receiving support then use Google or the fancy search bar in XDA.
I’ve got a successful build, what shall I do now?
Congratulations. Post your build on this thread or post to the ChaCha Google+ Community and we can test your ROM out. If you feel like you want some more advance work then continue forward to build AOKP, Paranoid Android and so on. The ChaCha community is needing ROMs you can help!
This project was set-up by the HTC ChaCha community on Google+. This was an open document which members of the community contributed to. All known people who have added to the document is listed below.
Google’s Android Open Source Project (Based of documentation)
Adlx (Created main instructions)
LucasArran (Editor)
Benjamin Gwynn (Proff-read and helped)
And all other members from the ChaCha Community!
Need support?-
If your not receiving a response to your error after a couple of days try posting your issues and errors on the HTC ChaCha Community for quick help.
Donation Note
Please do not donate because of this guide. It's a community made project.
Amazing! Thanks for making this available!
i downloaded the CM10 source but when downloading the device files, the system displays the error in manifest file, wget manifest is successful but repo gives me the below error. can you help
warning: local_manifest.xml is deprecated; put local manifests in `/home/user/WORKING_DIRECTORY/.repo/local_manifests` instead
warning: local_manifest.xml is deprecated; put local manifests in `/home/user/WORKING_DIRECTORY/.repo/local_manifests` instead
fatal: error parsing manifest /home/user/WORKING_DIRECTORY/.repo/local_manifest.xml: not well-formed (invalid token): line 37, column 34
Re: [NEW][GUIDE] How to build for HTC ChaCha!
ajeevlal said:
i downloaded the CM10 source but when downloading the device files, the system displays the error in manifest file, wget manifest is successful but repo gives me the below error. can you help
warning: local_manifest.xml is deprecated; put local manifests in `/home/user/WORKING_DIRECTORY/.repo/local_manifests` instead
warning: local_manifest.xml is deprecated; put local manifests in `/home/user/WORKING_DIRECTORY/.repo/local_manifests` instead
fatal: error parsing manifest /home/user/WORKING_DIRECTORY/.repo/local_manifest.xml: not well-formed (invalid token): line 37, column 34
Click to expand...
Click to collapse
You can ignore the warnings. Regarding the error, can you paste here the line 37?
Sent from my Galaxy Nexus
adlx.xda said:
You can ignore the warnings. Regarding the error, can you paste here the line 37?
Sent from my Galaxy Nexus
Click to expand...
Click to collapse
attached is the the local manifest file and here is line 37
<link data-pjax-transient rel='permalink' href='/adumont/android_device_htc_chacha/blob/5844aa97eb21e35b63cf9f13b48cf2a1ba40969b/extra/local_manifest.xml'>
ajeevlal said:
attached is the the local manifest file and here is line 37
<link data-pjax-transient rel='permalink' href='/adumont/android_device_htc_chacha/blob/5844aa97eb21e35b63cf9f13b48cf2a1ba40969b/extra/local_manifest.xml'>
Click to expand...
Click to collapse
ok, my mistake. The correct manifest url is https://raw.github.com/adumont/android_device_htc_chacha/jellybean/extra/local_manifest.xml .
With the new manifest, it made some progress but not sure if this is okay.
warning: local_manifest.xml is deprecated; put local manifests in `/home/ajai/WORKING_DIRECTORY/.repo/local_manifests` instead
Fetching projects: 0% (1/326) fatal: remote error:
CyanogenMod/[email protected]:/android_vendor_htc_chacha is not a valid repository name
Email [email protected]thub.com for help
Fetching projects: 1% (4/326) fatal: remote error:
CyanogenMod/[email protected]:/android_device_htc_chacha is not a valid repository name
Email [email protected] for help
Fetching projects: 39% (128/326) fatal: remote error:
CyanogenMod/[email protected]:/android_vendor_htc_chacha is not a valid repository name
Email [email protected] for help
Fetching projects: 61% (199/326) fatal: remote error:
CyanogenMod/[email protected]:/android_device_htc_chacha is not a valid repository name
Email [email protected] for help
Fetching projects: 94% (307/326) error: Cannot fetch android_vendor_htc_chacha
Fetching projects: 96% (313/326) error: Cannot fetch android_device_htc_chacha
error: Exited sync due to fetch errors
Re: [NEW][GUIDE] How to build for HTC ChaCha!
Local manifest seems to be outdated, you need to change the chacha 's git to point to github instead of assembla.
Sent from my Galaxy Nexus
not sure what i am doing wrong....... still the same
warning: local_manifest.xml is deprecated; put local manifests in `/home/ajai/WORKING_DIRECTORY/.repo/local_manifests` instead
fatal: remote error:
CyanogenMod/[email protected]:/android_device_htc_chacha is not a valid repository name
Email [email protected] for help
Fetching projects: 1% (4/325) fatal: remote error:
CyanogenMod/[email protected]:/android_vendor_htc_chacha is not a valid repository name
Email [email protected] for help
Fetching projects: 55% (179/325) fatal: remote error:
CyanogenMod/[email protected]:/android_device_htc_chacha is not a valid repository name
Email [email protected] for help
Fetching projects: 79% (257/325) fatal: remote error:
CyanogenMod/[email protected]:/android_vendor_htc_chacha is not a valid repository name
Email [email protected] for help
Fetching projects: 99% (322/325) error: Cannot fetch android_device_htc_chacha
error: Cannot fetch android_vendor_htc_chacha
error: Exited sync due to fetch errors
Best & the most organized TUT i've come across so far
I'm going to set-up an event in 3 weeks time (Maybe on the 5th of April) to help users with the HTC ChaCha source development. And hopefully end up with some ROMs in the end.
If anyone is interested in this please post your comments. I will only set this up if people are interested. Also I will host it on Google+ Hangouts with IRC. If the isn't any other easier way of helping.
Join the community on Google+ for more info.
lucasarran said:
I'm going to set-up an event in 3 weeks time (Maybe on the 5th of April) to help users with the HTC ChaCha source development. And hopefully end up with some ROMs in the end.
If anyone is interested in this even please post your comments. I will only set this up if people are interested. Also I will host it on Google+ Hangouts with IRC. If the isn't any other easier way of helping.
Join the community on Google+ for more info.
Click to expand...
Click to collapse
i am in
lucasarran said:
I'm going to set-up an event in 3 weeks time (Maybe on the 5th of April) to help users with the HTC ChaCha source development. And hopefully end up with some ROMs in the end.
If anyone is interested in this please post your comments. I will only set this up if people are interested. Also I will host it on Google+ Hangouts with IRC. If the isn't any other easier way of helping.
Join the community on Google+ for more info.
Click to expand...
Click to collapse
What about existing ROMS?
9v9 said:
What about existing ROMS?
Click to expand...
Click to collapse
Such as? The event is for building from source not current ROMs. But you can still come along with any other questions.
lucasarran said:
Such as? The event is for building from source not current ROMs. But you can still come along with any other questions.
Click to expand...
Click to collapse
I mean like cooking with an already ported ROM. But doing it from scratch from CM7 would be interesting to try. Is it a problem if I have no google+ or other accnts?
9v9 said:
I mean like cooking with an already ported ROM. But doing it from scratch from CM7 would be interesting to try. Is it a problem if I have no google+ or other accnts?
Click to expand...
Click to collapse
I won't be covering it, this is where you should start from and if you have any problems leave me a PM http://forum.xda-developers.com/c.php?t=1598713
lucasarran said:
I won't be covering it, this is where you should start from and if you have any problems leave me a PM http://forum.xda-developers.com/c.php?t=1598713
Click to expand...
Click to collapse
I will be doing this later this month and I will ask for help if it's needed. Thanks!
ERROR
I get this error when i type "repo sync -j8 WORKING_DIRECTORY"
CanYouSmell said:
I get this error when i type "repo sync -j8 WORKING_DIRECTORY"
Click to expand...
Click to collapse
When you see "WORKING_DIRECTORY" it refers to where you have decided to put your CM's sources... It's not the command to run.
In that case anyway, I'm not sure why it's even there.
THe command to sync the repo is:
Code:
repo sync -j8 -c
Hello xda,
I had a little time on my hands the other night, and wanted to figure out a way that I could work on any of the project repositories needed to build say, aokp, cyanogenmod, aosp, etc... without having to connect to the internet.
Mirroring is not new. Simple enough to:
Code:
mkdir cm-mirror
cd cm-mirror
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1 --mirror
repo sync -j[dl-jobs]
then create a working directory:
Code:
cd ..
mkdir cm-work
cd cm-work
repo init -u file:///Volumes/Android/cm-mirror/CyanogenMod/android.git --reference /Volumes/Android/cm-mirror/ -b cm-10.1
repo sync # no jobs needed. super fast.
But at this point you only have what you need for cm-10.1. What if you also have work you are doing for 10.1.0? Or an old update to make for cm-7.2.0?
I originally started looking for a solution to sync every branch in the manifest one at a time, but while talking with cdesai he showed me a really clean way of getting the repositories directly from gerrit.
Anyways, here is the resulting script. Let me know your thoughts.
I've moved the script to a git repository here: https://github.com/bhundven/repo-mm
in case anyone wants to contribute.
I've also written a post on my blog about using the new gerrit-mirror.sh on gh.
ChangeLog
Changes:
[06/30/13]: Announce some updates to gerrit-mirror.sh, and blog post.
[06/24/13]: Moved gist to github project.
GitHub for repo-mm.
if u dont have internet connection to make a ROM this guide is for you and you dont need to have download for GB's of file
first im taking carbon ROM for example
1.You will need to set up some directories in your build environment:
To create them run:
mkdir -p ~/bin
mkdir -p ~/carbon
2.Install the Repository
Enter the following to download the "repo" binary and make it executable:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
You may need to reboot for these changes to take effect. Now enter the following to initialize the repository:
cd ~/carbon
Repositories:
Before you continue --> run this in the terminal:
repo init -u https://github.com/CarbonDev/android.git -b kk
3.now open carbon folderand press ctrl + H if u see .repo folder u can continue to next
repo sync --> firsy sync for 5mins to load the folder and then stop syncing by closing terminal
4.after that see the manifest.xml with notepad or any suitable one and you can see link for the packages EXAMPLE: android_art search in the cyanogenmod or in which u want to build
5.im sharing link database of packages for building carbon rest u have the job to search and typer in github
package which to be downloaded for carbon ROM is here http://d-h.st/zru
6.after making source proper --> Building the System --->>>Initialize the environment with the envsetup.sh script. Note that replacing "source" with a single dot saves a few characters, and the short form is more commonly used in documentation.
. build/envsetup.sh
lunch
Enter the number of the build you want to start and press enter:
make carbon -j7 = Run Squisher/Run Opticharger
make otapackage -j7 = No Squisher/No Opticharger
optional --> Submitting Patches
Patches are always welcome! Please submit your patches via CarbonDev Gerrit! You can do this by using these commands:
Setting up for repo upload: (run these commands once)
git config --global review.review.carbonrom.org.username <Your username registered at CarbonDev gerrit>
git config --global review.review.carbonrom.org.email <Your email registered at CarbonDev gerrit>
(From root android directory)
. build/envsetup.sh
repo start kk .
(Make your changes and commit)
repo upload .
Note: "." meaning current directory For more help on using this tool, use this command: repo help upload
Make your changes and commit with a detailed message, starting with what you are working with (i.e. vision: Update Kernel) Commit your patches in a single commit. Squash multiple commit using this command: git rebase -i HEAD~<# of commits>
To view the status of your and others' patches, visit EAMPLE:Carbondev Code Review
if you want to build :
CYANOGENMOD -->do steps upto initialisng repo ------------https://github.com/CyanogenMod/android
OMNIROM -->do steps upto initialisng repo ------------https://github.com/omnirom/android
CARBON -->do steps upto initialisng repo ------------https://github.com/CarbonDev/android
dont click thanks if i helped you because thanks button is gonna damage
CREDITS:
---------> Ramsudharsan madhavan for teaching me
---------> Guru sanjay my friend helping me to download
---------> and me for thinking this idea in my school time
Goin gud. keep it up.
Awesome man!
Worth for Portal!
Sent from my Xperia Sola using XDA Premium 4 mobile app
Nevermind.