git初始化项目提交到码云

来源:互联网 发布:淘宝网宣纸 编辑:程序博客网 时间:2024/06/11 07:51

1在码云新建项目


2本地新建项目,包括readme.md,ignore这俩个文件

初始化仓库

git init 

关联远程仓库

git remote add origin git@github.com:YotrolZ/helloTest.git
git add *
git commit —m"初次提交"
E:\mm\zdh>git push -u origin master------------我们第一次push的时候,加上-u参数,Git就会把本地的master分支和远程的master分支进行关联起来,我们以后的push操作就不再需要加上-u参数了To https://gitee.com/antims/zdh.git ! [rejected]        master -> master (fetch first)error: failed to push some refs to 'https://gitee.com/antims/zdh.git'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., 'git pull ...') before pushing again.---------------------------------------提示要先拉取hint: See the 'Note about fast-forwards' in 'git push --help' for details.E:\mm\zdh>git pull origin masterwarning: no common commitsremote: Counting objects: 4, done.remote: Compressing objects: 100% (3/3), done.remote: Total 4 (delta 0), reused 0 (delta 0)Unpacking objects: 100% (4/4), done.From https://gitee.com/antims/zdh * branch            master     -> FETCH_HEAD * [new branch]      master     -> origin/masterfatal: refusing to merge unrelated historiesE:\mm\zdh>git push -u origin master-------------------不可以To https://gitee.com/antims/zdh.git ! [rejected]        master -> master (non-fast-forward)error: failed to push some refs to 'https://gitee.com/antims/zdh.git'hint: Updates were rejected because the tip of your current branch is behind--------提示你本地分支的版本落后(更新被拒绝,因为您当前分支的提示落后hint: its remote counterpart. Integrate the remote changes (e.g.hint: 'git pull ...') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.E:\mm\zdh>git push -u  -f origin master----------------------注释:-f是强制推送,覆盖远程Counting objects: 5, done.Delta compression using up to 4 threads.Compressing objects: 100% (2/2), done.Writing objects: 100% (5/5), 316 bytes | 0 bytes/s, done.Total 5 (delta 0), reused 0 (delta 0)To https://gitee.com/antims/zdh.git + b9d4e84...fb730f5 master -> master (forced update)Branch master set up to track remote branch master from origin.