Skip to main content
  1. Learn
  2. Software Development
  3. Guides
  4. Git tutorial
  5. How to use Git
  6. How to use Git on Command Line
  7. Push to a remote repository
GuidesSoftware DevelopmentBacklog

Project and code management together.

Push to a remote repository

Let’s push to the local repository you created at the beginning of this tutorial.

Use the git remote command and the URL of the tutorial repository to register a remote repository with the alias origin.

The remote repository‘s URL is registered under the name origin
$ git remote add origin https://[your_space_id][your_project_key]/tutorial.git

If you are on Console, the "origin" remote repository will be used by default if you omit the remote name when pushing/pulling. That is because convention commonly uses "origin" as a remote name.

Next, use the git push command to push a commit to the remote repository origin.

Specify the branch name you wish to push to. (We will cover branching in greater depth in the next section.) If you specify the -u option when executing the command, you can omit the branch name the next time you push to the remote repository. However, when you push to a vacant remote, you must specify the remote repository and branch name.

If you are asked for the username and password, enter your Backlog user credentials.

$ git push -u origin main
  Counting objects: 3, done.
  Writing objects: 100% (3/3), 245 bytes, done.
  Total 3 (delta 0), reused 0 (delta 0)
    * [new branch]      main -> main

Open the Git page on Backlog, and you will find a new update corresponding to your push to the remote repository listed under “Recent Updates”.

The push item is added to the recent updates

Once in the Git page, click into the tutorial repository and navigate to the Files tab. The pushed file will also appear in this tab.

The file from the pushed repository is added

Next, we’ll clone this remote repository.

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life