# How to deal with `README.md` caused the push rejected > Powered by ChatGPT :::danger This guide is for students that already has a `README.md` file already added in their GitLab project. If your GitLab project is empty when you open it **DO NOT** follow this guide. ::: You may remove the `README.md` and add the homework repository files to your repository and complete the homework. If you mess up on some of the step, you can clone your repo and do it again. ## Removing `README.md` and Pushing Changes In the first part of the guide, we will walk you through the steps to remove the README.md file from your Git repository(OOP2023f_XXXXXXXXX_HW) and push the updated repository to your remote host. We will be using the command-line interface (CLI) for these operations. ### Prerequisites Before proceeding, ensure you have the following: - Git installed on your local machine. - A Git repository(OOP2023f_XXXXXXXXX_HW)where you want to remove the `README.md` file. - Appropriate access and permissions to push changes to the remote repository. ### Steps #### 1. Open Your Terminal Open your terminal or command prompt on your local machine. #### 2. Navigate to Your Repository Use the cd command to navigate to the directory where your Git repository is located. For example: ``` bash cd /path/to/your/repository ``` #### 3. Verify Your Repository Status Before making any changes, it's a good practice to check the status of your repository. Use the following command to do so: ```bash git status ``` This will display information about the current status of your repository. #### 4. Remove `README.md` To remove the `README.md` file, use the git rm command followed by the file name: ```bash git rm README.md ``` #### 5. Commit the Changes After removing the `README.md` file, you need to commit the changes to your local repository. Use the following command: ```bash git commit -m "Remove README.md" ``` Replace `"Remove README.md"` with your own commit message. #### 6. Push the Changes to the Remote Repository Finally, you'll need to push the changes to the remote repository. Use the following command, assuming you are pushing to the main branch: ```bash git push origin main ``` Replace main with the name of the branch you want to push if it's different. #### 7. Verify on the Remote Repository After pushing the changes, visit your GitLab Repository to verify that the `README.md` file has been removed. ## Adding Files and Pushing to GitLab Repository The second part of the documentation will guide you through the process of adding new files to your local Git repository and pushing those changes to a GitLab repository. We'll use the command-line interface (CLI) for these operations. ### Prerequisites Before proceeding, make sure you have the following: - Git installed on your local machine. - A GitLab account with a repository where you want to add files. - Appropriate access and permissions to push changes to the GitLab repository. ### Steps #### 1. Open Your Terminal Open your terminal or command prompt on your local machine. #### 2. Navigate to Your Repository Use the cd command to navigate to the directory where your Git repository is located. For example: ```bash cd /path/to/your/repository ``` #### 3. Place the files on Homework repository Prepare the files which you clone from Homework repository and place the files on homework repository. #### 4. Check the Repository Status Before adding files, it's a good practice to check the status of your repository. Use the following command: ```bash git status ``` This will display information about the current status of your repository. #### 5. Stage the Files To add files to the staging area, use the git add command followed by the file names or directories. For example, to add all files in the current directory, use: ```bash git add . ``` To add specific files, replace . with the file names. #### 6. Commit the Changes After staging the files, commit the changes to your local repository with a descriptive message. Use the following command: ```bash git commit -m "Add new files" ``` Replace "Add new files" with your own commit message. #### 7. Push to GitLab To push the committed changes to your GitLab repository, use the following command: ```bash git push origin main ``` Replace main with the name of the branch you want to push to if it's different. #### 8. Verify on GitLab Visit your GitLab repository to verify that the new files have been successfully added. You can access your repository through the GitLab web interface.