Git tutorial to make your project open source sharing

Introduction to Git

Git is a distributed version control system open source, can efficiently at high speed process from small to very large version of the project management.

Why would versioning? I believe that many small partners may ask, because now the general project is relatively large, a person can not complete the development is bound to be in the form of the development team, so many people will have to develop a series of problems, this time we need to use version control tools.

For example, after our project needs to complete the first round, Party suddenly say I have a demand for a change, then the development team will be versions of the change, a demand for the development of the second round of the project, after completion, due to the Party for some reason, he said the second round of demand does not need, and change back to the first demand.

Super crazy people there? There is no version control tools, the development team had to develop again, to delete the second requirement, if the coupling of the code too, no less than once this redevelopment. This is obviously a waste of time and inefficient. Git code can be uploaded directly back version, it eliminates the need of rework.

Of course, the example cited above, bloggers are more extreme, daily use Git main function is to track the progress of the development point, there can upload logs to see time modify the content, and so on.

After all, most of the work is the lone wolf act in school, less able to have experienced development team. Git is used mostly for uploading the code to github, easy to download other small partners. So bloggers on the terms of use Git under upload method code to github of.

Git Download

git download site
Here Insert Picture Description
run after the download is complete, select the installation path
Here Insert Picture Description
suggested here Select
Here Insert Picture Description
here to select the first
Here Insert Picture Description
and then all the way next on the line, the installation is complete!

But wait, there is the final step in setting, open Git Bash on your desktop, enter the command window. Input:

git config --global user.email "here fill in your email"
git config --global user.name "fill in your name here."

After setting, Git installation is complete even if it really!

Git usage

Git is used mainly divided into two types, one is a local warehouse management, warehouse management and the other is remote.

Bo is the second speaker here.

首先去登陆我们的github,新建一个仓库。
Here Insert Picture Description
Here Insert Picture Description
我们的远程仓库就这样建好啦!

接下来我们怎么来上传本地的代码到远程的仓库呢?别急,一步一步来!

我们先在桌面建一个文件夹,然后右键,看到Git Bash Here,点击进入命令窗口。
Here Insert Picture Description
输入git init,进行初始化本地仓库
Here Insert Picture Description
然后github的上传是通过ssh加密的,所以需要创建ssh密钥。

输入ssh-keygen -t rsa然后一路回车
Here Insert Picture Description
在你的用户目录下会有一个.ssh的文件夹,打开里面生成了这两个文件
Here Insert Picture Description
上面一个文件是私钥,下面的一个是公钥。我们用记事本打开公钥,可以查看内容。复制下来,在github中添加。
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
接下来是创建本地仓库与远程仓库之间的连接。
输入git remote add origin https://github.com/你的用户名/仓库名.git
然后输入 git push -u origin master(第一次上传必须要加-u,之后就不需要啦)

完成后就把你要上传的项目文件夹放入你本地仓库的文件夹。
在命令窗口中输入git add 项目文件夹名,把你的项目添加至Git的暂存区
然后输入git commit -m"注释(这里可以随便打)"
Here Insert Picture Description
这样就是在本地仓库提交完成啦!

最后输入git push origin master,便上传到github的仓库啦!是不是很简单呢?
Here Insert Picture Description
博主之前的所有博客教学的源码资源都上传到github上了,链接为:github仓库
有需要的小伙伴可以自提。

结语

If this article had let you learn some knowledge, you may wish to point a praise and attention, so that bloggers can see. If you have to explain what is wrong and neglect, but also take the trouble to point out in the comments or ask questions, the first time bloggers will be updated and answer, thank you!

Published 10 original articles · won praise 12 · views 2588

Guess you like

Origin blog.csdn.net/weixin_44018540/article/details/104060392