The tutorial for creating a Git project under the Ubuntu Linux system and pushing it to a remote GitHub warehouse is as follows:
-
Install Git:
-
Run the following command in a terminal to install Git:
sudo apt update sudo apt install git
-
-
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
-
Add files to repository:
-
Add project files to Git repository. For example, if you have a
myproject
folder called , you can add it to the repository with:git add myproject
-
-
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"
-
-
Create a remote GitHub repository:
- Create a new repository on GitHub and get the remote URL of the repository.
-
Add remote repository:
-
Add the remote repository as the remote address of the Git repository with the following command:
git remote add origin <远程仓库URL>
-
-
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
master
the branch of the remote repository. When pushing for the first time, you need to use-u
parameters 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 push
You can push changes to remote repositories by running commands in the terminal . Hope this information helps you!