第一步:新建仓库
新建仓库步骤省略,最后我们得到一个仓库地址:
https://github.com/UnicornAmazon/×××××××××.git
第二步:进入要上传的文件夹,初始化上传文件夹仓库
$ cd ../python/machineLearningCode/ $ git init
第三步:添加所有文件到git
$ git add . $ git commit -m "first commit
第四步:连接到github仓库
$ git remote add origin https://github.com/UnicornAmazon/********.git
如果不是第一次上传,可能会提示一下信息:
fatal: 远程 origin 已经存在。
这时只需要将远程配置删除,重新添加即可;
$ git remote rm origin
$ git remote add origin https://github.com/UnicornAmazon/********.git