Github入门

GitHub Learning Lab
官网https://lab.github.com/courses

Git常用命令

 1 // git在本地创建仓库
 2 git init
 3 echo "Hello World!" > README.md
 4 git add -A
 5 git commit -m "my first commit"
 6 // 然后去Github创建一个仓库"luren"
 7 git remote add origin https://github.com/xiaoming/luren.git
 8 git push -u origin master
 9 
10 
11 // 如果远程仓库更新了而本地没同步,先pull再在本地解决冲突,之后merge
12 git pull origin master
13 git branch -a
14 git merge remotes/origin/master
15 git push -u origin master
16 
17 // 如果提示refusing to merge unrelated histories(当然你得确定是这个仓库)
18 git pull origin master --allow-unrelated-histories
19 
20 // 如果提示 而你不想git修改你的文件,可以从全局关掉它
21 // 更多换行符设置详见https://www.hhcycj.com/post/item/264.html
22 git config --global core.autocrlf false
23 
24 // git 推送代码到已有仓库
25 git add -A
26 git commit -m "add new Function"
27 git push -u origin master
View Code

 Git客户端华为镜像源下载

 

 注:关于Github课程

This branch has not been deployed

No deployments
 
 

Review required

At least 1 approving review is required by reviewers with write access. Learn more.
 
Merging is blocked
Merging can be performed automatically with 1 approving review.

这个合并报错并非操作失误,而是管理课程的人加了审核

 

所以必须仔细看,最好不要关掉这个页面 。第三节时会在Pull Requests和你继续教程内容

Tips:在页面的chrome开发工具打开时 ,鼠标按住刷新键可以选择强制刷新模式(不使用缓存)

此外Git还有很多功能 ,如submodule可以定义手动同步上游模块。(微软最新的终端项目仓库就用了这个东西,节省了托管服务器带宽)

 

 

附上安全解决git报错(push declined due to email privacy restrictions)

git报错-->! [remote rejected] master -> master (push declined due to email privacy restrictions) - 小辉辉的博客 - CSDN博客
附上为本地代码新建仓库并推送本地代码到远程仓库:

github入门到上传本地项目 - 偷偷有码 - 博客园

git-push到多个远程仓库,github,coding - mbinary - CSDN博客

Git常用命令大全,迅速提升你的Git水平 

 

 

 GitHub 第一坑:换行符自动转换 [Windows用户必看]

 

 

Linux中apt与apt-get命令的区别与解释 - 系统极客

 

如何使用 GitHub? - 知乎

 

 

Github 多账号配置

 

如果团队经常使用100M以上的单文件,建议看: Git LFS的使用 

 

另外,关于获取指定commit的记录

https://stackoverflow.com/questions/3489173/how-to-clone-git-repository-with-specific-revision-changeset

有趣的用法:建立静态博客网站

   ·虽然是静态的,但是引用一些js之后,连目录检索和评论功能都能拥有

https://hexo.io/zh-cn/docs/

 

 参考:https://zhuanlan.zhihu.com/p/60578464

转载于:https://www.cnblogs.com/yucloud/p/10604130.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值