github入门程序员

GitHub仓库操作

2016-04-01  本文已影响1111人  水书

1.创建仓库

点击 New repository出来的页面


创建参考图

各个参数选择

Repository name:仓库名称
Description:仓库说明,可留空
public/private:公开仓库/非公开仓库
Initialize this repository with a README:打上勾后,Github会自动 初始化仓库并设置readme文件,让用户可以立刻clone仓库。如果想向github添加已有git仓库,建议不勾
Add.gitignore:初始化时自动生成.gitignore文件;下拉菜单中包含主要语言与框架
Add a license:在下拉菜单中选择添加许可

2.连接仓库

https://github.com/用户名/仓库名

3.公开代码

clone 已有代码

将已有的仓库clone到开发环境中
查看ssh


clone URL

代码

$git clone git@github.com:shuis/HELLOWORLD.git
Cloning into 'HELLOWORLD'.......

这里会要求输入github上的公开密码的密码,认证成功后,仓库便会clone到仓库名目录中

提交编写的代码到仓库

$git add helloworld.php
$git commot -m "添加helloworld.php"

git add将文件加到暂存区,再通过git commit 命名提交
可以通过以下代码查看提交日志

$git log

push

$git push

执行后,Github上的仓库就会更新。

上一篇 下一篇

猜你喜欢

热点阅读