I have a desktop application using git for synchronization. I have also an android application which do the same as the desktop, but I don't know how to do the synchronization part on it. I haven't found any implementation of git on android. I found a jgit, but its unwell documented and I was not able to do even a commit with that.
I was thinking about remote commands to my git server from my android app, but this is really a tease for me.
Could you tell me if any other git implementation which can be used on android exists? If you have any idea how to solve that, please tell me.
Since this question was first posted, an Android app has been added to the market that can checkout Git repos, called Agit. It can't commit or push yet, but the clone/fetch/pull functionality is useful. The other issue is that a patched version of ConnectBot needs to be installed before Agit if you want to use SSH keys. If you already have ConnectBot, uninstall it first. I did not do this and ran into problems.
Edit: As of April 2021, the ability to push and pull has been added, however, it does seem to be very buggy as I have only been able to pull changes, but never push them.
Another option is using ASE. There seems to be a full-featured pure python implementation of git at https://github.com/jelmer/dulwich.
You can install https://github.com/termux/termux-app # https://play.google.com/store/apps/details?id=com.termux, then you just need to open the terminal and type:
apt update
apt install git
If the device is rooted, you can also use debian's debootstrap ( http://wiki.debian.org/Debootstrap ) application to create a debian/armel image, mount it in your android device and chroot to it, you have aptitude here so any package available for armel can be installed on your device (to install git: aptitude install git). Look here for information on how to install debian for your android: http://lanrat.com/install-debian-on-android/
Some other solutions that are now available, besided Agit, since this question was last answered:
A git & mercurial client for bitbucket called Bitbeaker
A git app from github
The Android Java IDE AIDE also has git functionality, so you can download from a git directory and if its an Android app modify and run it aswell.
You can also try Pocket Git: https://play.google.com/store/apps/details?id=com.aor.pocketgit
Pocket Git supports SSH (with passphrases, but private keys seem to have some issues) and HTTP, cloning, stage, unstage, commit, push and pull; create, delete and merge branches; and it also has a graphical log viewer and can show diffs.
Disclaimer: I'm the developer
A lot of already existing apps have been posted in the answers, but following links might be useful for those looking for their own implementation:
libgit2
This is a pure C implementation that claims to be highly portable. And the project also describes how to compile the sources for android platform. Now what needs to be done is to write a JNI binding for it. Even an executable binary would be sufficient in some cases.
HTTP (dumb) protocol
As an alternative, if one's purely interested in read operations from a repository, this protocol can be implemented over HTTP. There is also a smart protocol which depends on ssh and does differential transfers.
JGit Core Sources
Using just the core package from its sources. All the javax.* dependencies and other incompatible/alien classes will needed to be replaced with android alternatives though. But worth the effort if a pure Java implementation can be ported to android.
I would suggest to take a look at Gidder. It's Git server implementation for Android with user and repository management and also support dynamic DNS. You can easily store your code in your Android device and access using a WiFi connection.
MGit is the successor of SGit, and it works very well for me.
Update:
Comment underneath this answer by OP- (Nathan Osman)
unfortunately, I was forced to pull the application after some recent policy changes on the Play Store that required publishers to have their address displayed on the application's store page.
Original Answer
I've just (circa April 2013) published an app on the Play store named GitDroid. The application allows you to do the following:
clone remote repositories
pull from the remote and merge new revisions
view commits and browse files
The app cannot push to a remote or make local commits yet - this is planned for a future update.
This is how I would do it:
Well you likely want to define an interface for your synchronization needs.
You implement this interface in C for both desktop and android device (with the help of the NDK) by making the implementation use git (native).
Then, for the Android app, you code a JNI layer on top so that it exposes the interface to Java.
The tricky part would be to have the different git commands compile for Android: you'll have to rewrite makefiles.
Try SGit, it can commit & push over SSH with pssphrase-less keys and it is available on F-Droid. It is built on top of JGit. It is not perfect (yet) and JGit implementation is not as good as original Git, but looks usable.
You can install git on android with Termux. Just install from Play Store and run the command:
pkg install git
Reference: https://mvprepublic.com/blog/2020/04/08/how-to-run-git-on-android-devices/
Update: CubeGit has been removed because of changes inside the Android system and missing time / incentives to update.
Please pick one of the alternatives.
One more option is was CubeGit.
We have released CubeGit on Google Play a few days ago.
It is an interface to a cross compiled git binary and also supports local commits and push via ssh/http/https.
JGit - http://eclipse.org/jgit/
Related
I have built the webrtc for android using the Pristine IO web srcipts from here https://github.com/pristineio/webrtc-build-scripts. I have cloned the git repo of webrtc also, but don't see any tagged releases of it anywhere. In fact I don't see even a single tag and only 2-3 branches other than master.
My question is how do people generally version their webrtc builds? Is it solely dependent on git commit sha only?
Edit: generated files are
Hi #vKashyap usually the version is a part of the path or a library name (the output file after building) and it should look in your case like this: ./webrtc-build-scripts/ios/webrtc/libWebRTC-LATEST-Universal-Debug.a.version.txt
Moreover to fetch and build a particular version you can check the following guide:
https://www.chromium.org/developers/how-tos/get-the-code/working-with-release-branches
It would be easier to do things if you use the scripts provided by webrtc.org directly. Everything is simplified now as per as steps are concerned for building webrtc. See https://webrtc.org/native-code/android/
The webrtc.org code uses git so you can do the following (after you have done fetch --nohooks webrtc_android or equivalent steps) to get the tags:
git fetch --tags
Once you get the tags, you can switch to any tagged branch using git checkout for e.g.
git checkout branch-heads/55
The above command will checkout webrtc code equivalent to chrome 55. Then you can follow webrtc.org instructions to build.
We are an android developer team and we are doing our job on a single server using remote desktop. so everyone of our developers has a user account on the server and all are simultaneously developing using the android studio, we want to use git as version control but our repository must locate on that server not on git remote servers. how can we do that? we are already using Team Foundation Server but it has many problems so we want to switch to git.
any help would be appreciated.
Try using https://gitlab.com. It is free (Community Edition) and widely used.
If you know enough git to for use local repository /PC ( git init, git add, git commit , git checkout ) , you should not have much problem then. In your server you can prepare a git bare repository under any folder i.e. ( gitServer ) and create a remote on your local repository git remote ---. Now you sync up your local git with remote server easily through push, pull, fetch commands..
In case you need to understand git flow for 2-3 members of team, you can refer stackoverflow post How to use git correctly ?
gitlab is not proper for you if your group is small. It consumes a lot of memory and resources. I prefer Gogit https://github.com/gogits/gogs.
Thanks for all answers.
I used http://gitstack.com/
it is free for double teams.
I am new to Android Studio and to Android Development as well. I am presently using version 1.3.1.
My question is how to efficiently make project "snapshots". - I am not absolutely sure the term of "snapshot" is good hence the quotes.
What I mean is to save the project as is at the moment and be able to make heavy changes without fearing to destroy what is already working well and also to be able to restart from this "snapshot" if it happens that the changes made break the project.
In other terms, how can I manage versions?
This can be achieved using a version control program such as git or svn, although git tends to be the industry standard tool.
You can follow a very simple online tutorial to get started quickly with the basics behind git. There are also a number of other excellent resources such as the git guide by Tower and the git book.
In regards to versioning, you can use git tag to tag specific versions (see docs)
#Create a new tag
git tag -a v1.0 -m 'Version 1.0'
#Create a new working branch 'version_2_dev' from v1.0
git checkout -b version_2_dev v1.0
You need to add the version control plug-ins like bitbucket, svn and git.
I have a go library that i want to run on android and use its methods in my android app. I could write the whole android app in go to make it easier to use this dependency. Is this possible? If so, how?
Download Termux (Linux Emulator) from google play store and open it.
Next, wait for it to perform an automatic download of its resources. After that operation, the run the following command:
pkg install golang
pkg install git
The got package is required when downloading golang packages.
Eventually, you can test it by running (go) command.
Golang support for mobile development has been steadily improving. Today it is even possible to build some simple all Go apps (depending on which features you need) as well as Go libraries. Please see https://github.com/golang/go/wiki/Mobile for more info.
UPDATE: In further improvement, libraries are being created to support even UI on mobile platforms. https://fyne.io provides rather robust set of features for mobile.
You can use a Go library from Java when developing for Android with gobind (see this example in the gomobile repository). The biggest issue with this is integration into the build system.
For Go 1.5 things are getting better, but you'll have to wait for that.
Ever since Froyo (Android 2.2), Google's Android OS has supported syncing Microsoft Exchange accounts using the ActiveSync protocol. I am trying to find Android's implementation of the ActiveSync protocol within the Android code-base.
Does anyone know where ActiveSync is implemented in Android? I have been rummaging around the GitHub repository but cannot find it.
Right here, enjoy.
[EDIT] - if there are issues accessing the link above, the source is also on omapzoom.org. To see individual code files there, navigate to a "tree" link for any of the commits and dig down into the src folders. Here's an example.
Just download from the android git repository. If you are on linux, then wget -r --no-parent https://android.googlesource.com/platform/packages/apps/Exchange/+/master/exchange2/src/com/android/exchange ought to do it.