提交本地項目到GitHub 阿新 • • 發佈:2017-05-07 mysql remove abs actor const sre then mes ref [email protected] MINGW64 /d/test$ git initInitialized empty Git repository in D:/test/.git/[email protected] MINGW64 /d/test (master)$ git remote add origin [email protected]:luhonggang/MyBatisPageHelper.git[email protected] MINGW64 /d/test (master)$ cat .git/config --查看本地config文件 ,多了remote信息[core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true hideDotFiles = dotGitOnly[remote "origin"] url = [email protected]/* */:luhonggang/MyBatisPageHelper.git fetch = +refs/heads/*:refs/remotes/origin/*加完之後cat 查看 .git/config,這裏會多出一個remote “origin”內容,這就是剛才添加的遠程地址,也可以直接修改config來配置遠程地址 [email protected] MINGW64 /d/test (master)$ git add -A[email protected] MINGW64 /d/test (master)$ git commit -m ‘first commit‘On branch masterInitial commitnothing to commit[email protected]/* */ MINGW64 /d/test (master)$ git push origin mastererror: src refspec master does not match any.error: failed to push some refs to [email protected]:luhonggang/MyBatisPageHelper.git‘ -- 錯誤說明: 因為是第一次提交項目到當前庫,所以第一次向當前庫提交之前要先執行pull命令[email protected] MINGW64 /d/test (master)$ git pull origin master ---拉取倉庫上所有的數據Warning: Permanently added the RSA host key for IP address ‘192.30.255.112‘ to the list of known hosts.remote: Counting objects: 4, done.remote: Compressing objects: 100% (3/3), done.remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0Unpacking objects: 100% (4/4), done.From github.com:luhonggang/MyBatisPageHelper * branch master -> FETCH_HEAD * [new branch] master -> origin/master[email protected]