Linux shell提交github安装以及使用

来源:互联网 发布:站内优化 编辑:程序博客网 时间:2024/06/18 10:09
•安装yum  install gitgit config  //git配置修改•Linux中创建pub key,导入github•git init 创建新项目并上传(或者git clone)•建立新文件,git add•git commit•git push

两项基本配置:

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

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

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

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

[root@HTY-1 SortedPriceName]# git pushTo 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 rejectedMerge the remote changes before pushing again.  See the 'Note aboutfast-forwards' section of 'git push --help' for details.

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

[root@HTY-1 SortedPriceName]# git pull originYou asked to pull from the remote 'origin', but did not specifya branch. Because this is not the default configured remotefor your current branch, you must specify a branch on the command line.[root@HTY-1 SortedPriceName]# git pull origin masterFrom github.com:crazyyanchao/SortedNmaePrice * branch            master     -> FETCH_HEADMerge made by recursive. README.md |    2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) create mode 100644 README.md
0 0
原创粉丝点击