github简单应用

来源:互联网 发布:淘宝店进货渠道 编辑:程序博客网 时间:2024/05/22 13:08
若本地的文档想上传到github上:
1个人github主页创建新仓库:
首先在github个人主页上创建一个新的仓库 起一个名字
2仓库初始化:
本地文档下 git init 会多一个隐藏文件夹.git
3配置git:
输入命令:git config --global user.name "你的用户名"
输入命令:git config --global user.email 你的邮箱地址
4添加托管文件:
git add ./*   是所有所有的文件 
5commit项目:
git commit -m "描述信息(修改了什么,新增了什么)"
6上传项目:
git remote add origin 仓库地址
git push -u origin master
git pull
git push


如果版本低的话会出现错误:
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/hankai17/linux_pro.git/info/refs
fatal: HTTP request failed
解决方法:
vim .git/config 
修改:
[remote "origin"]  
    url = https://github.com/hankai17/example.git
为:url = https://hankai17@github.com/hankai17/example.git

如果想在本地删除文件,同时反映到个人网页github上:
先rm -rf test
再git rm test/*
再git commit -m "delete test/*"
再git pull
再git push

“git remote add origin 仓库地址”:这个命令只用输一次,以后就不用再输入了
直接git add,git commit,git pull,git push

参考的是强哥的链接 http://www.cnblogs.com/yongqiang/p/6114488.html

---------------------------------------------------------------------

git push origin pdns-recursor_devlp

git log

0 0