Github上传自己的工程

1.注册并新建项目

2.配置github for windows

 前题:安装相应的github for windows

2.1 获取密钥

可以用命令的模式(Git bash),参考资料中有相应的用法;在这里我用图形来获取(Git GUI)。

在help>show ssh key>点击generate key

在网页,自己的设置中

添加上面的密钥,如下图

再在Git Bash输入命令查看是否成功

2.2 配置信息

git config --global user.name "自己的用户名"

git config --global user.email "自己的邮箱" 

2.3 上传文件

可以先克隆仓库。(git clone 工程网址)

我选择另外一种方式。

首先在git在本地创建一个相同的项目;

git init    //初始化 
touch README.md
git add README.md   //更新README文件
git commit -m '1st_commit' 
git remote add origin git@github.com:你的用户名/工程名.git   //连接远程github项目  
git push -u origin master   //将本地项目更新到github项目上去

出现的问题:

1).

git remote add origin git@github.com:defnngj/Data_Structure.git //连接远程github项目

出现:

fatal: remote origin already exists.

git remote rm origin 

 2).

git push -u origin master //将本地项目更新到github项目上去

出现:

error:failed to push som refs to

git pull origin master  

 3).

git push -u origin master

方案:

git pull --rebase origin master

4)

查看

添加

 git add <file>... 

参考资料:

http://www.cnblogs.com/fnng/archive/2011/08/25/2153807.html

http://www.cnblogs.com/findingsea/archive/2012/08/27/2654549.html

http://jingyan.baidu.com/article/f7ff0bfc7181492e27bb1360.html

http://blog.csdn.net/samhacker/article/details/20129213

原文地址:https://www.cnblogs.com/boyiliushui/p/6040458.html