Fork and Clone Fire App Builder, then Add a Remote
Downloading files from GitHub is easy, but suppose you want to properly set up a Git repository to pull updates from the Fire App Builder repo when those updates become available. If so, you'll need to fork and clone the repo, and then add the Fire App Builder repo as a remote that you can pull from.
- Fork and Clone Fire App Builder, then Add the Fire App Builder as a Remote
- Getting Updates
- Git Resources
Fork and Clone Fire App Builder, then Add the Fire App Builder as a Remote
- If you're on Windows, before you clone the Fire App Builder repository, make sure that in your git settings, you have symbolic linking set as
true. Otherwise, if you clone the repo without git's symbolic linking configured to
true, Fire App Builder won't build. To enable symlinks:
- Check whether you have admin privileges on your computer (by going to Start > Control Panel > User Accounts > Manage User Accounts). If you don't have admin privileges, it's okay. You can run a later script to fix any issues.
If you do have admin privileges, open your command line terminal as an administrator and run the following to configure git to allow symlinks:
git config -–global core.symlinks true
When you run this command, git config will be set to enable symlinks. All Linux symlinks will be converted to Windows symlinks during git clone.
- Go to https://github.com/amzn/fire-app-builder.
- Click Fork in the upper-right corner and (if prompted) select the GitHub account you want the repo forked to. Forking a repo creates a copy of the repo in your own GitHub account. The path to your forked repo will be
github.com/<your github username>/fire-app-builder.
- Click Clone or Download, and then copy the clone URL.
- Open your command line and browse to a convenient directory for the project.
Clone the project with the
git clonecommand, replacing
<your github username>with your actual username if you forked the repo:
git clone https://github.com/<your github username>/fire-app-builder.git
git is initialized in a directory called fire-app-builder, and the Fire App Builder project is downloaded.
- Windows users: If you didn't have administrative permissions to run
git config --global core.symlinks trueas explained earlier, see Configure Symlinks for Windows Without Admin Privileges to convert the symlinks in the downloaded files.
You can pull in future updates by adding the Fire App Builder repo as a "remote" to your forked repo. From the command line,
cdto your new
fire-app-builderdirectory and type the following:
git remote add amzn-fab https://github.com/amzn/fire-app-builder.git
This adds a remote called "amzn-fab" to your repo. (You can name the remote whatever you want.)
Pull from the Amazon remote, specifying the primary branch:
git pull amzn-fab master
If there are no new changes to pull, the response is as follows:
From https://github.com/amzn/fire-app-builder * branch master -> FETCH_HEAD Already up-to-date.
If there are changes, you'll see the changed files listed in the response. You will see merge conflicts for any files with the same name in the amazon/fire-app-builder that you've customized in your own repo. (For example, you'll see conflicts with navigator.json if you've modified this file.)
Follow standard Git practices for resolving merge conflicts. See Resolving a merge conflict using the command line.
If changes in the original repository's files conflict with changes you've made to your local copy, git will not automatically overwrite your local copies with the updates. Instead, git will show you merge conflicts for the affected files and remove the affected files from its tracking. You need to resolve the merge conflicts, add the files back into git tracking, and commit your update.
When you see merge conflicts, run
git statusto see a list of the problematic files. Open the files and look for the carrots (
<<<<<<) indicating areas of conflict. Manually edit the files to remove the carrots, selecting the changes you want to keep and deleting those you want to discard. Then add the file back into git tracking with
git add ..
When you're finished resolving conflicts, build your app to make sure everything works. Then push the changes into your own GitHub repo.
When Amazon pushes out updates to Fire App Builder, you'll want to pull these updates into your own repo. You can do this by adding a remote to your existing GitHub repo. To add the remote:
Here are some good resources for working with git: