Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Upload local projects to GitHub

Shulou Source: shulou.com Published: 2022-06-03 07:18:33 11月23日 Update

Step 1: cd to your local directory and execute the git command

Git init / * version library initialization command * /

You can then see a hidden .git folder in the local directory, and the local directory and its subdirectories are the workspace.

Step 2: submit the directory or file to the staging area and execute the git command

Git add. / File name

This command submits the local directory or file to the staging area.

Step 3: submit the files of the temporary storage area to the version library and execute the git command

Git commit-m "comments"

Note: the file has been changed at this time. If you want to submit the modified file to the version library, you must first store the modified file in the temporary storage area by git add, and then submit the file from the temporary storage area to the version library by git commit.

Step 4: create your own repository on GitHub, as follows:

Step 5: associate the local version library to GitHub and execute the git command

Git remote add origin https://github.com/zdandan212/zhaoxiaohu

The address above is the repository address you created.

Step 6: push the current master branch to the corresponding branch of the default host (master)

Git push origin master

Step 7: the-u option specifies a default host so that git push can be used later without any parameters.

Git push-u origin master

OK if there are no mistakes.

Tags: Files commands versions directories storage areas hosts branches addresses that is parameters subdirectories subdirectories workspaces file names folders comments errors associations jobs push Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Information MariaDB Linux Docker