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
.
$ git remote add origin https://[your_space_id].backlog.com/git/[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
Username:
Password:
Counting objects: 3, done.
Writing objects: 100% (3/3), 245 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://example.backlog.com/git/BLGGIT/tutorial.git
* [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”.
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.
Next, we’ll clone this remote repository.