异常描述
$ git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using
git remote add <name> <url>
and then push using the remote name
git push <name>
原因分析
本地通过Git下载代码后进行了修改,在推送至远程仓库时缺少目标仓库地址
解决方案
1. 本地客户端远程连接目标仓库
git remote add origin https://github.com/**/*.get
2. 推送本地代码至远程仓库分支
git push -u origin master
注意:
以上操作是在本地已经执行add及commit命令并将代码纳入本地仓库管理的前提下操作。如果本地代码未提交至本地仓库管理则需要先执行以下操作
-- 添加文件至缓存区
git add ./project
-- 提交代码至本地仓库
git commit -m '本次提交代码注释'