Create a Git project under the Ubuntu Linux system and push it to the remote Github tutorial

The tutorial for creating a Git project under the Ubuntu Linux system and pushing it to a remote GitHub warehouse is as follows:

  1. Install Git:

    • Run the following command in a terminal to install Git:

      sudo apt update
      sudo apt install git
  2. Create a local Git repository:

    • Change into the directory where you want to create the project.
    • Run the following command in a terminal to initialize the Git repository:

      git init
  3. Add files to repository:

    • Add project files to Git repository. For example, if you have a  myprojectfolder called , you can add it to the repository with:

      git add myproject
  4. Submit to local repository:

    • Use the following command to submit the file to the local warehouse and add the submission information:

      git commit -m "Initial commit"
  5. Create a remote GitHub repository:

    • Create a new repository on GitHub and get the remote URL of the repository.
  6. Add remote repository:

    • Add the remote repository as the remote address of the Git repository with the following command:

      git remote add origin <远程仓库URL>
  7. Push to remote warehouse:

    • Push the contents of the local repository to the remote repository with the following command:

      git push -u origin master

      This will push the contents of the local repository to  masterthe branch of the remote repository. When pushing for the first time, you need to use  -uparameters to establish the association between the local warehouse and the remote warehouse.

After completing the above steps, your local Git project will be pushed to the remote GitHub repository. git pushYou can push changes to remote repositories by running commands in the terminal  . Hope this information helps you!

Guess you like

Origin blog.csdn.net/tiansyun/article/details/132114837