xmxm76 发表于 2018-1-13 22:22:09

git 怎么上传文件到github上

git 怎么上传文件到github上
1、安装git    sudoapt-get install git2、配置全局变量    git config --global user.name langhunm    git config --global user.email langhunm@163.com    该配置被写入到了用户目录下的.gitconfig文件中    查看全局变量    gitconfig--list3、创建项目,步骤是创建项目目录,进入目录使用git init命令初始化项目,比如:创建项目example    1)mkdir example-->cd example    2)git init(执行该命令后 会在该目录下创建一个.git文件夹[包含repository的框架文件],该命令的作用是初始化repository[源] )4、将本地源与远程源链接    git remote add example https://github.com/langhunm/example.git(该命令的作用有两个,一个是将本地源起了一个名字叫example。另一个作用是将本地这个源与远程的源联系起来了)5、在本地源上制作源文件,对该源文件进行跟踪,提交该源文件到本地源,    1)创建源文件 touch a.c    2)对源文件进行跟踪,git add a.c    3)对源文件进行提交,git commit -m "first commit" 6、同步本地源与远程源    git push example master(同步本地源example分支到远程源master分支中)7、在新的电脑上克隆远程源到本地    git clone https://github.com/langhunm/example.git example(该命令的作用是克隆远程源中的master到本地源,并将本地源分支命名为example,若不指定example,则默认为origin) git各种信息查询的方法:1、查询全局变量 git config --list2、查询本地源跟踪状态 git status3、查询本地源的提交状态 git show 4、查询远程源的信息 git remote -v   第一步   初始化一个仓库(当前目录下),   git   init                如果 git init   AA   - 在当前目录下创建一个目录 AA 第二步   远端仓库 和本地仓库的链接   git remoteaddAA(远端仓库名)   +   远端仓库地址 第三步    gitstatus   查看显示状态    //   githelp               git   add+"文件名"               git commit-m"描述"               git pull            git pushAA (远端仓库名)+master(本地master分支)  posted on 2017-04-19 17:36 Mr_liyang 阅读(...) 评论(...)编辑 收藏
页: [1]
查看完整版本: git 怎么上传文件到github上