idea项目上传到git遇到的问题

1、git下载安装ok

2、在idea中创建好项目路径,再右击项目名--选择git--Add,并将项目提交到本地仓库(git--commit),这时文件名会变成绿色

idea项目上传到git遇到的问题_第1张图片


idea项目上传到git遇到的问题_第2张图片

3、在git上创建仓库,与本地仓库名相同,然后进入本地仓库内,鼠标右键选择Git Bash Here。依次输入

git remote add origin [email protected]:{github用户名}/{repository名}.git
git pull [email protected]:{github用户名}/{repository名}.git

这里的用户名和仓库名不能写错

这里报错还有其他几种情况:

fatal: remote error:
   is not a valid repository name
  Email [email protected] for help

连接项目后设置分支在pull: 

git branch –set-upstream-to=origin/master master

pull完成还报错:

$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"

4、开始选择所有文件开始上传

$ git add .
$ git commit -m "首次提交上传"
$ git push [email protected]:{github用户名}/{repository仓库名}.git

这里可能出现错误

fatal: remote error:
   is not a valid repository name
  Email [email protected] for help

那就是由于你的git公钥没有设置,检查是否有公钥:

$ cd ~/.ssh

没有就直接生成,ssh-keygen中间没空格

$ ssh-keygen -t rsa -C "你的email"

以前有公钥的,删除再生成

$ mkdir key_backup 
$ cp id_rsa* key_backup 
$ rm id_rsa*

$ ssh-keygen -t rsa -C "你的email"

然后再重新上传

$ git push [email protected]:{github用户名}/{repository仓库名}.git

最后上传如果还有问题,再试试

idea项目上传到git遇到的问题_第3张图片

git config remote.origin.url [email protected]:{git的名称}/{项目}.git


有可能会报错:

fatal: The current branch master has no upstream branch.
解决办法:

git push -u origin master
其中origin是远程git仓库名,可写成

参考链接: http://blog.csdn.net/qqb123456/article/details/25319659

你可能感兴趣的:(svn)