Fixing Git Bash Vagrant issue

The following steps will fix the issue where the blank shell input appears after running `vagrant ssh` on Windows 10:

Screenshot of Git Bash blank terminal input

This bug appears to be caused by a conflict between the ssh executable that comes with vagrant and the one that comes with Git Bash.

The problem can be solved by setting the VAGRANT_PREFER_SYSTEM_BIN environment variable to 1.

To do this, follow the below steps:

Step 1) Click Start and type “System” to open up the System menu within control panel.

Screenshot of clicking start and typing System and selecting system menu

Step 2) Click Advanced system settings from the System menu.

Screenshot of clicking Advanced system settings from within the system menu

Step 3) From the System Properties window, click on Environment Variables…

Screenshot of clicking Environment Variables from the System Properties window

Step 4) Under System variables, select New… to add a new environment variable.

Screenshot of clicking New from within the System variables section of the Environment Variables window

Step 5) In the Variable name box, type VAGRANT_PREFER_SYSTEM_BIN and in the Variable value box enter 1 and click OK.

Screenshot of typing VAGRANT_PREFER_SYSTEM_BIN within Variable name and 1 within Variable value

Step 6) Close and re-open any Git Bash windows you have open, and re-run vagrant ssh.

You should now be able to execute commands on you Vagrant server.

 

Disable “LF will be replaced by CLRF” warning in Git on Windows

If you’ve ever used Git in windows, you may have seen something like this every time you add files to Git:


warning: LF will be replaced by CRLF in www/index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in www/templates/dash.html.
The file will have its original line endings in your working directory.

If you want to turn it off, type this:


git config --global core.safecrlf false

Done.

How to clone a GitHub project on Android Studio

You may have read/watched my previous tutorial How to use GitHub with Android Studio 1.x. This is a follow up tutorial which explains how to clone a project that has been added to GitHub. 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.

Click here to download an easy-to-follow PDF version of this post

Read more

How to remove a git remote

In the comments of my article How to use GitHub with Android Studio 1.x, Cynthia gets the following error:


can't add remote
fatal: remote origin already exists.
during execution git remote add origin

Read more

How to use GitHub with Android Studio 1.x

Previously, I wrote a post called How to use GitHub with Android Studio, which was based on the beta version of Android Studio. Since then, Android Studio has progressed past the Beta phase and is now officially the primary IDE for Android.

As I expected, they added GitHub support so you no longer have to follow the tutorial in my previous post 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.

Read more

How to use GitHub with Android Studio

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.

Click here to download an easy-to-follow PDF version of this post Read more

What to do if Aptana Stuido 3 stops allowing you to commit to git?

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: 3.4.2.201308081805 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 "email@address.com"
git config --global user.name "Firstname Lastname"

Creating central git repository

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 user@host.com:/home/[user]/repo/myproject.git

That’s it. In a future post I’ll explain for you can integrate this with an IDE.