How to upload a local engineering GItHub

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/hyy_blue/article/details/92844506

1 First of all you should have a GitHub account, not go into details here, to create a separate project, described in the picture

Click on new
Insert picture described here
Here Insert Picture Description
to fill in the name of the project on the map you want to create, pay attention to if you want to create a folder will add a "/" after the file name, this will create a folder (project).

Here Insert Picture Description
Here Insert Picture Description
Copy the address of the warehouse will be used later

2 and then went to download a git, git can download online search, there are many tutorials, the following is the official website address: https://git-scm.com/downloads/
installation tutorial: http://jingyan.baidu.com/article /7f766dafba84f04101e1d0b0.html
after installation, it opens the Bash Git

Here Insert Picture Description
3 into your existing project file. For example, I was day22
Here Insert Picture Description
4 execute git init command

git init


It should be initialized, because this command is executed the second time, so it should appear initialized, if you are the first execution will be initialized.
Executing the hidden files will be generated in a .git. ls -al can see.
Here Insert Picture Description
5 and then execute the command git add. [FBI WARNING] Note that there are points behind. ""
Indicate the addition of all the files in the directory to the local staging area. Without warning after the successful implementation

This time we can execute git status command to view the results.
Here Insert Picture Description
6 Run: git commit -m "initialize project"

`引号里是提交的注释,大家应该养成好的习惯,每次都写上注释,这样大家都能知道你本地提交做了什么。(事实上默认的你不写注释是无法提交的)`

Here Insert Picture Description

git commit命令会把本地暂存区中的文件提交到本地历史区,只有在本地历史区中的内容才能提交到github。执行该命令后,我们所有的文件都只是在本地。和github没有任何关系。

7 Run: git the Add Remote Origin [your warehouse address] https://github.com/Blue-53Hz/projectname-.git
This command is to add a local historic district files to the staging area github server. This step is a step of local and remote server to establish contact. There will be no prompt executed successfully.
8 Run: git pull origin master --allow-unrelated
Here Insert Picture Description
-histories Note:
may open a text editor that lets you write execution after submitting description. Direct: x to exit (ctr + ":" + x )

9 Finally, execute the command: git push -u origin master

A dialog box will pop up, you need to fill in GitHub account and password.
This step will really be submitted to the local code to github warehouse. After execution is completed, go to your github look, there will be a warehouse and as your local code.
Here Insert Picture Description

This thing is complete upload a local project to GItHub.

Learn https://www.shiqidu.com/p/90

Guess you like

Origin blog.csdn.net/hyy_blue/article/details/92844506