git使用遇到的问题

1、我新建了一个django项目,然后又在git上新建了一个仓库,然后我在django的项目文件内,将git上的项目clone到这个文件内的时候
git clone https://gitee.com/One-Tom/RMBS.git 的时候提示我
fatal: destination path 'RMBS' already exists and is not an empty directory.

出现的原因是:
解决方案是:
1、先输入 git remote rm origin
2、再git remote add origin 你的仓库地址
接下来就可以进行add 等操作了
2、在我进行了add commit ,最后准备进行git push的时候出现新的问题
$ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master
    
出现的原因是:在push代码时,出现原因是没有将本地的分支与远程仓库的分支进行关联

解决方案:
第一种如上图中的提示:git push --set-upstream origin master。其中的origin是你在clone远程代码时,git为你创建的指向这个远程代码库的标签,
它指向repository。为了能清楚了解你要指向的repository,可以用命令git remote -v进行查看。master是你远程的branch,可以用git branch -a查看所有分支,
远程分支是红色的部分。然后确定好这两个值后,将值换掉即可。 另一种方法是:git push
-u origin master。同样根据自己的需要,替换origin和master。(自己用的是这种方法) 执行完之后就可以看到

猜你喜欢

转载自www.cnblogs.com/one-tom/p/12075150.html