Getting Started with Git & Creating your Repository

In order to use your git repository first you need to install Git. We've put together a guide on installing Git to Windows. On macOS, git comes installed. In case you don't have Git installed in Mac OS, you can download git-scm downloads or use a package manager like homebrew or MacPorts.

You can also install Git from source or use package management, for instance:

yum install git-core
apt-get install git-core

Once installed, we recommend initializing Git. Fire up your command line app such as Terminal (on Mac) or Git bash (on Windows) and run the following commands.

git config --global user.name "John Smith"
git config --global user.email "johnsmith@gmail.com"

Use your full name and email address, and by this you will setup Git for your purposes. You need to do this only once, the first time you install Git.

Start using Git

There are many different ways to use your Git repository. Since Git is very flexible you can start using your repository easily by importing, cloning, and many other ways.

We will show you a couple of common ways to start using your Git repository.

Starting from scratch

To start using your repository from scratch, in your command line type the following:

git clone https://accountname.git.beanstalkapp.com/gitreponame.git -o beanstalk
cd gitreponame
echo "This is my new project on Beanstalk." > README
git add README
git commit -m "My first commit."
git push beanstalk master

With the commands above, you will create a folder, add a file to it, make your first commit, and push the changes to your repository, to master branch. Master branch is the default branch to use for your files.

Note: Beanstalk allows you to use SSH or HTTPS to connect to your Git repository. The example above shows the latter, but you can find both URLs at the top right of each repo page.

Import existing files on your computer

To import your existing files from your local machine type the following in your command line:

cd my-project
git init
git remote add beanstalk git@accountname.beanstalkapp.com:/gitreponame.git
git add .
git commit -m "Importing my project to Git, without saving history."
git push beanstalk master

Import (clone) an existing SVN repository

In case you have used SVN repository before using Git, you would probably want to convert your repository to use it with Git. You can do this easily by typing following in command line:

git svn clone https://account.svn.beanstalkapp.com/my-project my-project
cd my-project
git remote add beanstalk https://account.git.beanstalkapp.com/repo.git
git push beanstalk master

Move an existing Git repository

In order to move an existing repository, type the following in your command line:

cd my-git-repo
git remote add beanstalk git@accountname.beanstalkapp.com:/gitreponame.git
git push beanstalk

More Git resources

To find out more about Git, read our article on getting started with Git for tutorials and books about Git.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us