参考自:http://blog.csdn.net/listener51/article/details/53872174#t7

1、在windows系统客户端安装git工具


Github代码仓创建及更新

2、安装好git后,配置系统环境

安装完Git后,将安装路径如:c:\Program Files\Git\bin 添加到系统环境PATH中。此路径下有git.exe,方便后续的命令操作。

3、在github上创建仓库

在github创建仓库用于存储管理本地文件,示例:Blog。点击账号前的加号(Create New)--New repository,根据引导创建一个Blog仓库。

Github代码仓创建及更新

4、clone上步新建的respository到本地

 在本地电脑上先新建一个文件夹,在文件夹路径如下图
Github代码仓创建及更新
敲入cmd后,按回车,出现DOS窗口。
在DOS窗口输入命令:

 git clone https://github.com/Flowerowl/stumansys.git

这时会在目录下生成:

Github代码仓创建及更新

5、将想上传的代码目录拷贝到此文件夹下


Github代码仓创建及更新 

6、输入命令:

git init

git add .

git commit -m 'stumansys'

git remote add origin https://github.com/Flowerowl/stumansys.git

git push origin master

注: git add . 这个命令会把当前路径下的所有文件,添加到待上传的文件列表中。如果想添加某个特定的文件,只需把 . 换成特定的文件名即可。

git commit -m "注释语句"  是将上传的文件后加 一个标记,如:

Github代码仓创建及更新

如果执行git remote add origin

https://github.com/Flowerowl/stumansys.git

,出现错误:

  fatal: remote origin already exists

则执行以下语句:

  git remote rm origin

再往后执行git remote add origin https://github.com/Flowerowl/stumansys.git 即可。

在执行git push origin master时,报错:

  error:failed to push som refs to.......

则执行以下语句:

  git pull origin master

先把远程服务器github上面的文件拉先来,再push 上去。

7、更新github

 如果github存在某个项目后,需要对此项目里的部分文件进行更新,只需要从第4步开始。

8、Github中Fork和更新原作者的修改

参考:https://my.oschina.net/u/2306127/blog/369167?p=1

相关文章:

  • 2021-12-22
  • 2021-10-16
  • 2021-07-14
  • 2021-05-31
  • 2021-05-16
  • 2021-05-27
猜你喜欢
  • 2021-04-01
  • 2021-11-26
  • 2021-12-06
  • 2021-08-30
  • 2021-07-14
  • 2021-11-24
  • 2021-12-20
相关资源
相似解决方案