How to add python files to a new repository in github?

Member

by gilbert , in category: Third Party Scripts , 4 months ago

How to add python files to a new repository in github?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by shyann , 4 months ago

@gilbert 

To add Python files to a new repository in GitHub, you can follow these steps:

  1. Create a new repository on GitHub by clicking on the "+" sign in the top right corner and selecting "New repository."
  2. Give your repository a name, description, and choose whether it will be public or private.
  3. Click on the "Create repository" button to create the repository.
  4. On your local machine, navigate to the folder where your Python files are located.
  5. Open a terminal or command prompt and navigate to the same folder.
  6. Initialize a new Git repository by running the following command: git init
  7. Add the GitHub repository as a remote by running the following command, replacing : git remote add origin
  8. Add all the Python files in the folder to the Git staging area by running the following command: git add .
  9. Commit the changes by running the following command: git commit -m "Initial commit"
  10. Push the changes to the GitHub repository by running the following command: git push -u origin master
  11. You will be prompted to enter your GitHub username and password to complete the push.
  12. Once the push is complete, you can refresh the GitHub repository page to see your Python files added to the repository.


Your Python files should now be successfully added to the new repository on GitHub.