通过idea工具将本地代码添加到网络git服务器上
来源:互联网 发布:罗技鼠标怎么编程 编辑:程序博客网 时间:2024/06/15 05:35
一,工具
输入git命令:
git pull --rebase origin master
操作步骤:
idea、git 安装、配置均不赘述。
二, 本地项目git提交
1.创建本地仓库
2.代码提交到本地git(先add 后commit)
三,项目提交
window下cmd到项目所在目录。如:D:\gitspaces\demo\aaa
需要提交到网络git中(如:开源中国):https://git.oschina.net/xxxxx/aaa.git
注:用https的方式连接,别用SSH的方式连接!
输入git命令:
1.git remote add origin https://git.oschina.net/xxxxx/aaa.git
2.git push origin master
输入用户名和密码。
如果出现
error: failed to push some refs to 'https://git.oschina.net/xxxxx/aaa.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
出现错误的主要原因是github中的README.md文件不在本地代码目录中
出现错误的主要原因是github中的README.md文件不在本地代码目录中
输入git命令:
git pull --rebase origin master
操作步骤:
D:\gitspaces\demo\aaa>git remote add origin https://git.oschina.net/xxxxx/aaa.git
D:\gitspaces\demo\aaa>git push origin master
Username for 'https://git.oschina.net': xxxxx
Password for 'https://xxxxx@git.oschina.net':
To https://git.oschina.net/xxxxx/aaa.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://git.oschina.net/xxxxx/aaa.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
D:\gitspaces\demo\aaa>git pull --rebase origin master
warning: no common commits
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From https://git.oschina.net/xxxxx/aaa
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
First, rewinding head to replay your work on top of it...
Applying: 新增aaa目录
Warning: Your console font probably doesn't support Unicode. If you experience s
trange characters in the output, consider switching to a TrueType font such as C
onsolas!
D:\gitspaces\demo\aaa>git push -u origin master
Username for 'https://git.oschina.net': xxxxx
Password for 'https://xxxxx@git.oschina.net':
Counting objects: 50, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (41/41), done.
Writing objects: 100% (50/50), 10.93 KiB | 0 bytes/s, done.
Total 50 (delta 17), reused 0 (delta 0)
To https://git.oschina.net/xxxxx/aaa.git
825d126..0ff4c7b master -> master
Branch master set up to track remote branch master from origin.
D:\gitspaces\demo\aaa>
备注:
方法/步骤
在使用git 对源代码进行push到网络git上时可能会出错,信息如下
此时很多人会尝试下面的命令把当前分支代码上传到master分支上。
$ git push -u origin master
但依然没能解决问题
出现错误的主要原因是网络git中的README.md文件不在本地代码目录中
可以通过如下命令进行代码合并【注:pull=fetch+merge]
git pull --rebase origin master
执行上面代码后可以看到本地代码库中多了README.md文件
阅读全文
0 0
- 通过idea工具将本地代码添加到网络git服务器上
- Git--将服务器代码更新到本地
- 将本地代码上传到github详解--git工具学习
- Git将本地代码提交到coding上,切换分支
- Git命令提交代码到Gitblit本地服务器上
- 如何通过Xcode将代码上传到git上。
- 通过 Git 将代码提交到 GitHub(上)
- git 将本地项目添加到Github
- git将本地项目添加到Github
- 利用git bash(git命令行)将本地代码上传到github上
- 利用git bash(git命令行)将本地代码上传到github上
- xcode通过git-tf连接TFS,将本地项目成功上传到TFS服务器
- xcode通过git-tf连接TFS,将本地项目成功上传到TFS服务器
- 使用git将代码存入远程仓库github和从github上克隆代码到本地
- 提交本地代码到git服务器
- git 命令之 如何将本地新建分支推到服务器上
- git 命令之 如何将本地新建分支推到服务器上
- 将本地IDEA项目推送到远程git
- JAVA中的值传递和引用传递,String的值传递特性
- Python扩展库
- Java 数据精确度处理&Mach类
- PHP中字符串的处理方式
- ThreadPoolExecutor源码详解
- 通过idea工具将本地代码添加到网络git服务器上
- 快速排序 算法 原理+ code 详解
- linux—文件分割
- 初一升初二第一次暑假集训
- POJ-2109
- poatman教程一
- php 向数据库表中插入数据
- LeetCode
- AX 2012 SSRS Failed-tempuri.org