git创建本地仓库与gitcafe关联-创新互联

git init                               # 创建本地仓库
# 设置远程仓库地址,这里可以设置ssh 或 https 的形式,此处设置为https 格式,
# ssh 格式为 : git  remote add origin git@coding.net:sql031625/test.git
git remote add origin https://git.coding.net/sql031625/test.git         

touch a.py        # 创建文件,使仓库有新的变更
git add .        # 添加所有变更
git  commit  -m  'first'               # 注释
git push -u oringin  master            # 推送代码,第一次使用 -u ,以后便可以不使用 -u 参数 
                                # 可以设置 git config --global push.default matching命令,使得push命令默认push到github的同名仓库中

若最后一步出错,

创新互联公司专注于企业成都全网营销推广、网站重做改版、彭水苗族土家族网站定制设计、自适应品牌网站建设、H5场景定制商城网站制作、集团公司官网建设、外贸营销网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为彭水苗族土家族等各大城市提供网站开发制作服务。
ralap@Ubuntu:~/data/coder/webtest$ git push -u origin master
Username for 'https://git.coding.net': sql031625
Password for 'https://sql031625@git.coding.net': 
To https://git.coding.net/sql031625/test.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://git.coding.net/sql031625/test.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,导致该文件不在本地代码中,执行以下命令,将git 仓库中的文件与本地合并,然后再上传即可

git pull --rebase origin master
git push -u oringin  master

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。

网站名称:git创建本地仓库与gitcafe关联-创新互联
本文地址:https://www.cdcxhl.com/article40/ccspeo.html

成都网站建设公司_创新互联,为您提供企业网站制作外贸建站移动网站建设电子商务外贸网站建设建站公司

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

网站优化排名