您的位置:首页 > 运维架构 > Shell

Linux shell提交github安装以及使用

2016-06-16 22:12 411 查看
•安装
yum  install git
git config  //git配置修改
•Linux中创建pub key,导入github
•
git init 创建新项目并上传(或者git clone)
•
建立新文件,
git add
•
git commit
•
git push


两项基本配置:

#配置使用
git仓库的人员姓名
git config --globaluser.name “Mike"
#配置使用
git仓库的人员email
git config --global user.emailyou@xyz.com


本地无项目是这样操作(与clone有点区别):

#
初始化一个版本仓库
git init
cd existing_folder
git init
git remote  add origin git@DX2:kennethxian/testproject.git
//remote add重命名指令
git add  .
git commit
git push -u origin master


遇到的错误以及解决办法:

[root@HTY-1 SortedPriceName]# git push
To git@github.com:crazyyanchao/SortedNmaePrice.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:crazyyanchao/SortedNmaePrice.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'Note about
fast-forwards' section of 'git push --help' for details.


以上报错通过更新本地仓库解决,之后重新提交ok!

[root@HTY-1 SortedPriceName]# git pull origin
You asked to pull from the remote 'origin', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.
[root@HTY-1 SortedPriceName]# git pull origin master
From github.com:crazyyanchao/SortedNmaePrice
* branch            master     -> FETCH_HEAD
Merge made by recursive.
README.md |    2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
create mode 100644 README.md
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  github shell git linux shell