前面创建仓库参考http://www.cnblogs.com/ruofengzhishang/p/3842587.html
创建仓库和验证
ssh -T git@github.com
git clone https://github.com/LianJion/blogmove.git
传输文件阶段
(1)进入对应仓库目录下
Administrator@USER-20151114HY MINGW64 ~ (master)
$ cd blogmove
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git init
Reinitialized existing Git repository in C:/Users/Administrator.USER-20151114HY/blogmove/.git/
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git add 'move'
添加move文件夹
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git remote add origin https://github.com/LianJion/blogmove.git
fatal: remote origin already exists.
出现第一个问题
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git remote rm origin
解决了
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git remote add origin https://github.com/LianJion/blogmove.git
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git push origin master
fatal: unable to access 'https://github.com/LianJion/blogmove.git/': Failed to connect to 127.0.0.1 port 8087: Connection refused
出现第二个问题
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git config --global http.proxy
127.0.0.1:8087
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git config --global --unset http.proxy
解决了
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git push origin master
Everything up-to-date
出现第三个问题:提示更新但是没有上传成功
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git push origin master
Everything up-to-date
问题分析:也就是说一开始 git 服务器仓库是完全空的,
不包含任何一个分支(branch),因此刚开始 Push 时需要指定一个。
执行 git remote -v 后看到自己的 remote 端名字为 origin:
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git remote -v
origin https://github.com/LianJion/blogmove.git (fetch)
origin https://github.com/LianJion/blogmove.git (push)
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git branch
* master
我感觉就是因为之前没有弄下面这句才错的
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git commit -m 'move'
[master af01149] move
3 files changed, 136 insertions(+)
create mode 100644 move/demo.html
create mode 100644 move/democss.css
create mode 100644 move/hair.jpg
Administrator@USER-20151114HY MINGW64 ~/blogmove (master)
$ git push origin master
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 5.59 KiB | 0 bytes/s, done.
Total 6 (delta 0), reused 0 (delta 0)
To https://github.com/LianJion/blogmove.git
3ca9a0f..af01149 master -> master
成功啦!
参考来源:
http://www.cnblogs.com/ruofengzhishang/p/3842587.html 问题1
http://blog.csdn.net/lly20000/article/details/46903143问题2
http://blog.csdn.net/jiangnan_java/article/details/21192675 问题3
http://jingyan.baidu.com/album/f3e34a12a25bc8f5ea65354a.html?picindex=5 (之前遇到)问题4