Appendix: Using VS Code or Terminal to Commit and Push Changes

This section provides instructions for committing and pushing changes to your Gitea repository. You can follow the steps using either Visual Studio Code or the terminal, depending on your preference.

Steps for Committing and Pushing Changes

Follow the steps below to commit and push changes to your Gitea repository. Choose the method that suits you best.

Using Visual Studio Code

  1. Right click to create the file under the tasks directory of your vm_management collection

    new file
    Figure 1. New File Creation
  2. Make the appropriate changes to your file and VSCode Editor will auto-save.

  3. Open the Source Control Panel:

    • Click the Source Control icon in the Activity Bar.

      source control
      Figure 2. Source Control
  4. Stage Your Changes:

    • Locate the files listed under Changes.

    • Click the + icon next to each file to stage them, or click the + icon next to Changes to stage all files.

      source changes
      Figure 3. File Changes
  5. Enter a Commit Message:

    • In the input box at the top of the Source Control panel, type a descriptive commit message, e.g.:

      Add changes to main.yml
  6. Commit the Changes:

    • Click the ✔ Commit button to commit the staged files.

      source commit
      Figure 4. File Commit
  7. Push the Changes:

    • Click the Sync Changes button to push the changes to your Gitea repository.

  8. Verify in Gitea:

Using the Terminal

  1. Git clone the gitea repository:

    git clone -b rh1-2025 https://gitea.apps.cluster-guid.dynamic.redhatworkshops.io/user1/virt-aap-day2
  2. Switch to the directory:

    cd /path/to/virt-app-day2
  3. Make changes to file and save it:

    vi /path/to/tasks/main.yml
  4. Stage Your Changes:

    • Run the following command to stage all modified files:

      git add -u
  5. Set your Git identity:

    • Run the following command only once:

      git config --global user.email "user1@redhatworkshops.io"
      git config --global user.name "User1"
  6. Commit Your Changes:

    • Commit the staged files with a descriptive message:

      git commit -m "Add changes to main.yml"
  7. Push Your Changes:

    • Push the committed changes to the remote repository

    • You will be asked for user user1 and password password.

      git push
  8. Verify in Gitea:

Conclusion

This appendix provides step-by-step instructions for using Visual Studio Code or the terminal to commit and push changes to your Gitea repository. Use these steps to ensure your work is safely stored in the remote repository, and refer to this section as needed during the labs.