Skip to content

Push to Git

Make sure that you complete Setup GitLab before proceeding, since this step assumes that your Git repository is setup properly.

Create a Kotlin project, and commit/push it to GitLab.

Steps

Step 1. Getting working copy

First, you need to git clone your GitLab repository to your local machine so that you have a working copy.

Open the web page for your GitLab project. Click on the Code button, and copy the URL from Clone with HTTPS.

GitLab

In a terminal, on your computer, cd to the location where you want to keep your source code. git clone the URL.

$ git clone https://git.uwaterloo.ca/cs346/public/mm.git

In this example, we would have a folder named mm that contains the contents of the Git repository.

Step 2. Add an empty project

Follow the instructions under create-a-project, and copy that directory structure into your working folder.

Step 3. Update .gitignore

Check that you have a .gitignore file in your source tree. It should include at a minimum .idea and build/ folders.

Step 4. Push changes

Once you have confirmed that your project is working, you can commit and push the changes.

$ git add *
$ git commit -m "Initial commit"
$ git push

Step 5. Share with everyone

Your teammates should now be able to git clone the project URL to get a copy of this repository.

Final Word

Git
XKCD: Git