码云的git使用教程1-利用Git从本地上传到GitHub

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lxn9492878lbl/article/details/83342468

码云的git使用教程1-利用Git从本地上传到GitHub

第一步: 进入要所要上传文件的目录输入命令

git init

第二步: 创建一个本地仓库origin

git remote add origin 你的在码云上的链接
比如
[email protected]:你的用户名/你的项目名称git

第三步:
添加的你的文件到本地仓库origin
你要添加一个文件xxx到本地仓库,使用命令

git add xxx 或者 git add .

然后把这个添加提交到本地的仓库

git commit -m ”说明这次的提交

注意,commit操作才是真正的提交。
第四步:

本地仓库origin提交到远程的仓库

git push  -u origin master

如果无法提交可以强制提交

git push -u origin master -f

整体的过程可以如下

git init
git remote add origin https://.............git
git add README.md
git commit -m "first commit"
git push -u origin master

也许你下一次隔一两天再次想上传的时候发现上传不上去了,出现了下面的字符

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

这个时候你可以重新初始化本地

git init
git push origin master -f

猜你喜欢

转载自blog.csdn.net/lxn9492878lbl/article/details/83342468