怎么在github上建立自己的代码仓库
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了怎么在github上建立自己的代码仓库相关的知识,希望对你有一定的参考价值。
参考技术AGithub是一个分布式版本控制系统,最初由Linux之父Linus Torvalds编写,在云时代的今天已经成为了开发者管理代码和发现已有代码的最常用工具之一,下面我们将开始git之旅。
注册Github账号:
首先打开Github主页,https://github.com 如果你没有登录过的话会打开如下图的界面,
注意右侧不是登陆界面而是注册界面,按要求填写用户名,邮箱,密码,点击Sign up for Github,开始注册账号。
保持personal plan下面的Free选中(如果想使用private的代码仓库的话可以选择其他选项,¥¥),先不选Help me set up an organization next,点击Finish sign up。
一个Github账号就创建成功了,接下来创建一个代码仓库(repository):
点击右边的+New repository开始创建仓库,如图,
在图中repository name下写上你的仓库名,在Description那里填写描述(可选不填),保持Public选中(如果选Private可以选择谁能看到谁能提交,public只能选谁能提交,private是要钱的¥),下面Initialize this repository with a README决定是否生成一个README文件来初始化仓库,可选可不选,点击Create
repository。
这样就生成了一个代码仓库了,如图中HTTP中的地址就是该仓库的地址,你可以通过git工具来访问到你保存在Github上的代码,也可以点击切换到SSH来生成SSH地址,点击地址邮编的按钮可以复制地址,如果在命令行中使用git的话可以使用下面提供的命令创建仓库。
创建一个仓库:
[plain] view plain copy
<span style="font-size:18px;">touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/kezhenxu/android.git
git push -u origin master</span>
这样,一个属于你自己的Github仓库就完成了,接下来就可以在eclipse中开始编写代码并且同步到Github上了,把Github当作一个代码备份和中转站确实是一个好主意,不过通过Github分享你的代码给所有人用或许才是Github更有价值的体现。怎么上传自己的代码/项目到自己的github仓库上
![](https://image.cha138.com/20210609/4980fc1b18b04c668a9e3c48e8f6f803.jpg)
![](https://image.cha138.com/20210609/cb281ecc26a046fdbd5823dbc8cddba9.jpg)
![](https://image.cha138.com/20210609/efab263cffb246a28c02255c578053ce.jpg)
![](https://image.cha138.com/20210609/ea30d7513a0d43d69f6c50841ee6bf76.jpg)
![](https://image.cha138.com/20210609/d3d263c71c244e4585e311d8736ec8e1.jpg)
![](https://image.cha138.com/20210609/3b8879b700664c199adef756f09dd02e.jpg)
![](https://image.cha138.com/20210609/4633aacfb7d94f2ea7afd07d49b61d70.jpg)
![](https://image.cha138.com/20210609/28b6c6e441b54d239c4d02814f6c4659.jpg)
![](https://image.cha138.com/20210609/27daa1c7ac864d6190671efc5b0709e1.jpg)
![](https://image.cha138.com/20210609/bb0620bc11ec46c88e5d0524cc2d207c.jpg)
![](https://image.cha138.com/20210609/c24d843348e14f5da8ef0203ef555f74.jpg)
![](https://image.cha138.com/20210609/49a63493272646fdad4a1b6231f219e8.jpg)
![](https://image.cha138.com/20210609/84e44f2d724a45d298e9a5d7a3b59a70.jpg)
![](https://image.cha138.com/20210609/5cb4305af0464f7cac5f682ed90e71e5.jpg)
![](https://image.cha138.com/20210609/920eedc4853a49759724b260481204d0.jpg)
![](https://image.cha138.com/20210609/a64e5d25daad4a67a496c802de035bf1.jpg)
![](https://image.cha138.com/20210609/0b967450ed824abd8b6e6330fd645bef.jpg)
![](https://image.cha138.com/20210609/7167da0b54d74e9e92feeabec0951e00.jpg)
以上是关于怎么在github上建立自己的代码仓库的主要内容,如果未能解决你的问题,请参考以下文章
上传及更新代码到github(以及如何在vscode上提交自己的代码)