This article provides a basic overview of how to use GitHub with Android Studio. If you’re looking for more in-depth training, check out my ebook How to Use GitHub with Android Studio: A complete step-by-step guide to mastering the technology.
Android Studio is currently in Beta phase. However given that it is most likely to supercede Eclipse as the next Android IDE, I thought it would be a good idea to start using it now to develop my apps.
Like many software engineers, I use Git as my source control software. I have a set of Git repositories that I keep on a Digital Ocean cloud virtual machine. This serves as a central place to store my code as well as a backup in-case my hard disk fails or someone comes and steals my computer (knock on wood).
When I first started using Android Studio, it took me some time to figure out how to work from a remote Git repository over SSH using private/public key authentication. As a result, I wrote this guide on how to do it.
At the time of writing this guide, I am using the following on my development machine:
I had the following problem:
I had been working on a project and wanted to commit my changes to git. When trying to commit (clicking Commands > Commit), it would let me type a message and add the files, however when I click Commit, the box closes but it doesn’t actually commit anything.
I was using Aptana Studio 3, build: 18.104.22.168308081805 on Windows 8.
It doesn’t display any error messages, however after some investigation I was able to resolve this issue. It turns out that git didn’t know my email address or name, which meant I couldn’t commit.
I resolved this by doing the following:
1. Exit Aptana Stuido and then use windows explorer and find the projects folder.
2. Right click the folder and select “Git Bash”.
3. Set my email address and name by typing the following:
git config --global user.email "firstname.lastname@example.org" git config --global user.name "Firstname Lastname"
This post describes how to change a hostname on a Debian 7 Linux server, however it will work on most other Linux distributions too.
Switch to root
Change the /etc/hostname file
echo 'new.host.name' > /etc/hostname
Restart the hostname service
That’s it. The host name is now updated.
Hi there, this is something that helps me out frequently so I wanted to share it with the community.
If you are at all security conscious, you will want to use public/private key authentication, instead of regular passwords, when authenticating to your servers.
This short guide will explain, quite simply, how to add your SSH private key to your server, so you can authenticate with your public key. This guide assumes you already have your public key to hand. I am using Debian 7, however it will work with many other popular distributions of Linux such as CentOS and Ubuntu.
1. Login to your server, and change to your home directory.
2. Create a new folder called .ssh.
3. Set the permissions on .ssh to 700.
chmod 700 .ssh
4. Change into that directory.
5. Create a new file called authorized_keys.
6. Set the permissions to 600 (many applications including OpenSSH will reject your key by default, if it’s accessible by other users).
chmod 600 authorized_keys
7. Open the file with a text editor (I use vi), and paste your keys in.
That’s it. Now disable password authentication in SSH to improve the security of your box.
Thanks for reading.
Here are all the commands together in-case you are want a quick copy and paste job:
cd ~ mkdir .ssh chmod 700 .ssh cd .ssh touch authorized_keys chmod 600 authorized_keys vi authorized_keys
Cloud based source control systems such as github are a great addition to the everyday toolkit of the software engineer. However, what if you want to host your own local git repository? Maybe for security, budget limitations of just personal preference?
This post will explain how you can do just that. During this explanation I am using Debian 7, but it should work on other operating systems too.
Let’s get started.
1. Install git
sudo apt-get install git
2. Create a directory. The name does not matter at this point, since this will only be a temporary directory. I named mine ‘git_project’ and stored it in my home folder.
cd ~ mkdir 'git_project'
3. Now initialise the temp folder as a repository.
cd ~/git_project git init
4. Now copy the files you want to initialise the repository with into this temp directory. If you plan to add files later, just create a temp file.
cd ~/git_project touch initial.temp
5. Now add all the files in the repository.
git add *
6. Next, commit the files as the initial commit.
git commit -m 'Initial Commit'
7. Now set it to a bare repo. This means that only the bare git repository will be stored, and not the source code files.
git config --bool core.bare true
8. Now move the hidden git file to your central repository location (I store mine in ~/repo). At the same time give it a project name.
mv .git ~/repo/myproject.git
9. You can now clone this repository using the command line.
git clone email@example.com:/home/[user]/repo/myproject.git
That’s it. In a future post I’ll explain for you can integrate this with an IDE.
Wondering how to create, populate and configure a Scroll View inside a View Controller using Storyboards in Xcode 5? This is for you.
Let’s get started.
Add a blank View Controller to your storyboard.
How I became a software engineer
- Android Studio
- Aptana Studio
- Career advice
- Django REST Framework
- Getting Help
- Git Flow
- Ionic Framework
- Job Search
- Mac OS X
- Salt Stack
- Stack Overflow
- Windows 10