如何使用github代码仓库
一直使用github托管代码,但是也是最近才熟练起来,在此分享给大家。
第一步:新建Repositories
第二步:
这里我们起名字为text,然后点击Create repository
然后会出来下面这个页面:
第三步添加忽略文件.gitignore,在这里给大家推荐个网址,里面都是写好的忽略文件,直接复制就可以了https://github.com/github/gitignore。
第四步:
echo "# Text" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/yulong12/Text.git
git push -u origin master
中间可能需要验证用户名和密码,至此完成
下面是常用命令:
git pull :下拉代码(每次push之前最好先pull)
git status :查看当前状态,课查看哪些文件未push
git add . :添加文件
git commit -m "注释"
git push 向代码仓库中push代码