IDEA GIT连接[email protected]

Git介绍请关注

廖雪峰的官方网站查看说明或是在Oschina中查看帮助

?

IDEA配置:

首先安装git for windows?推荐使用这个:http://msysgit.github.io/?

可以在任何目录 右键——git bash 弹出对应路径的 git 命令行窗口 而且启动速度比较快

在Intellij中Settings——Version Control——Git——Path to Git executable

找到安装git ?bin目录下的git.exe

1.方法一 ?适用于新建项目

先在[email protected]上创建仓库 ?拿到[email protected]仓库的HTTP连接http://git.oschina.net/lujianing/GitOSC.git

在Intellij IDEA工具栏中 VCS——Checkout from Version Control——Git 粘贴 URL 然后点击CLONE?

会创建并且复制仓库文件到本地项目中,注意:你创建的是一个poject,请自行创建对应的model。 ?然后你可以做相应的修改操作,你就可以在本地项目中进行Git ?add commit等操作了

最后可以在项目中Git ——Repositroy——PUSH ?提交到[email protected]中了(第一次提示输入账号密码)

就是这么简单 有木有....

下面是对应的一些截图

?

2.方法二 ?适用于已有项目

先在[email protected]上创建仓库 ?拿到[email protected]仓库的HTTP连接http://git.oschina.net/lujianing/test2.git

如果本地项目非Git项目 首先把项目变成Git的项目

在intellij中 VCS——Import into Version Control——Create Git Repository ?选择你的本地项目?

通过git shell (可以安装git for window) 进入到项目目录?执行?

git remote add origin http://git.oschina.net/lujianing/test2.git

git push -u origin master??(这个是命令行提交项目可以不用执行 ?参考方法一中在intellij中push)

如果提交失败 请参考git提示进行解决 ?比如已经有remote地址 可以git remote?rm?origin清除

如果是仓库中有其他文件 ?本地项目中没有?可以参考后两个图 首先merge项目?

项目就提交到[email protected]了 ? 以后的再有修改提交仓库就可以参考方法一的push操作了?

就是这么简单有木有

下面是对应的一些截图

?

git for windows推荐使用这个:http://msysgit.github.io/

可以任何目录 右键——git bash 弹出对应路径的 git 命令行窗口 而且启动速度比较快

对于方法二 适用于已有项目 ?

通过命令行?git remote add origin xxxxxxx ?后 添加远程连接后

首先?git remote?pull 从远程同步项目文件?

?

常见错误:

1.error:failed to push some refs to ...

当要push代码到git时,出现提示:


error:failed to push some refs to ...

Dealing with "non-fast-forward" errors

From time to time you may encounter this error while pushing:

$ git push origin master?

To ../remote/?

?! [rejected]??????? master -> master (non-fast forward)?

error: failed to push some refs to ‘../remote/‘?

To prevent you from losing history, non-fast-forward updates were rejected

Merge the remote changes before pushing again.? See the ‘non-fast forward‘

section of ‘git push --help‘ for details.

?
?

问题(Non-fast-forward)的出现原因在于:git仓库中已经有一部分代码,所以它不允许你直接把你的代码覆盖上去。于是你有2个选择方式:

?
?

强推,即利用强覆盖方式用你本地的代码替代git仓库内的内容

git push -f

?
?

2.?先把git的东西fetch到你本地然后merge后再push

$ git fetch

$ git merge

这2句命令等价于

$ git pull?

可是,这时候又出现了如下的问题:

上面出现的?[branch "master"]是需要明确(.git/config)如下的内容


[branch "master"]

??? remote = origin

??? merge = refs/heads/master

这等于告诉git2件事:

1,当你处于master branch,?默认的remote就是origin。

2,当你在master branch上使用git pull时,没有指定remote和branch,那么git就会采用默认的remote(也就是origin)来merge在master branch上所有的改变

如果不想或者不会编辑config文件的话,可以在bush上输入如下命令行:

$ git config branch.master.remote origin?

$ git config branch.master.merge refs/heads/master?

之后再重新git pull下。最后git push你的代码吧。

?

3.git错误:fatal: remote origin already exists.

输入 git remote rm origin 即可?

?

?

4.如何同时维护多个GIT REMOTE 及 FATAL: REMOTE ORIGIN ALREADY EXISTS 的问题解决

微信公众群比如‘python-django‘里不少小伙伴都在使用github做开源代码,为了分享面更广泛能不能同时维护多个git而不用同一源码在本地拷贝多份呢?
答案是可以的,举个例子,我有个项目已经在github上了:
$ git remote add origin http://github.com/objcc/HappyNewYearIOS.git

查看配置:

$ vi .git/config

[remote "origin"]

?? url = https://github.com/objcc/HappyNewYearIOS.git

?? fetch = +refs/heads/*:refs/remotes/origin/*

?

会报"fatal: remote origin already exists"错误失败。解决方法是换个名字:

$ git remote add oschina http://git.oschina.net/objcc/HappyNewYearIOS.git

$ git push oscine master

?$ git remote -v

origin????https://github.com/objcc/HappyNewYearIOS.git (fetch)

origin????https://github.com/objcc/HappyNewYearIOS.git (push)

oschina????http://git.oschina.net/objcc/HappyNewYearIOS.git (fetch)

oschina????http://git.oschina.net/objcc/HappyNewYearIOS.git (push)

这里将‘orign‘换成了‘oschina‘,然后在push到osc时也是一样。

安装GIT请看oschina的帮助文档,注意,注册完帐号后要在帐号配置中重置密码,刚开始不知道。折腾半天。刚注册完的密码可能为空。

IDEA GIT连接[email protected]

时间: 2024-08-04 14:32:15

IDEA GIT连接[email protected]的相关文章

Xcode连接[email protected]

Git初体验 http://my.oschina.net/dxqr/blog/134811 网友整理的[email protected]教程 http://git.oschina.net/oschina/git-osc/wikis/help#toc_19 [email protected]工作流程 http://git.oschina.net/oschina/git-osc/wikis/help 安装设置 git下载最新版本的githttp://git-scm.com/downloads当你安装

How to provide username and password when run "git clone [email protected]"? - Stack Overflow

How to provide username and password when run "git clone [email protected]"? - Stack Overflow

git clone [email protected]:snuglove/ 报错

[[email protected]_centos7_5 ~]# git clone [email protected]:snuglove/Job-hunting-related.git Cloning into 'Job-hunting-related'... ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository. Please mak

Xcode连接[email protected] (oschina git代码托管)

Xcode 已经集成了git,建立新项目时钩选使用git,然后按照下面步骤让Xcode和git@osc 建立连接. 第一步:成生SSH密钥 打开终端命令工具,输入命令:ssh-keygen -t rsa -C "[email protected]" 注意ssh-keygen没有空格.屏幕输出: Generating public/private rsa key pair. Enter file in which to save the key (/Users/diaosi/.ssh/i

git笔记[email protected]

之前安装了git,用了不久就升级系统了,发现又忘记了步骤,虽然网上有很多教程,但寻找需要浪费太多的时间,由于github连接比较慢,所以使用了开源中国的托管http://git.oschina.net/,安装流程写在oneNote里. 1.首先需要安装git<a href="http://git-scm.com/download/">Git官网</a>,安装好之后会又Git GUI和Git Bash,就用命令行吧~~ 打开Git Bash,简单的配置下: 先建立

连接[email&#160;protected]操作步骤

一.准备工作 软件下载 Git:地址 TortoiseGit:地址 二.安装与配置 1.Git安装 Git配置 设置客户端的用户名和email 然后,到[email protected] 上面注册一个帐号. 这个帐号就是设置客户端的eamil 下一步,根据eamil生成key 生成key的命令 ssh-keygen -t rsa -C "youer email" 如果命令无误执行后,会在当前用户文件夹下,建立一个.ssh的文件夹,文件夹中有两个文件分别是id_rsa和id_rsa.pu

配置Git绑定[email&#160;protected]

用户名,这个名字会出现在以后的提交记录中. git config --global user.name "[email protected]用户名" 然后是Email,同样,这个Email也会出现在你的提交记录中,此Email要与[email protected]的注册Email一致. git config --global user.email "[email protected]账号" 生成SSH key SSH key 可以让你在你的电脑和 Git @ OSC

git clone [email&#160;protected]:xxx.git Permission denied (publickey) 问题解决办法

From: https://www.cnblogs.com/restart/p/4633928.html 如果git无法通过普通的http去clone远程分支,可以选用ssh方式去连接.这时需要配置相应的公私钥(本地生成公私钥对儿,把公钥配置到远程git服务器上即可). 具体的错误提示如下: 要debug这个问题,可以用 ssh -vT 参数,比如下面: 解决方案: 首先要设置你的系统的公共,私有密钥(ssh-keygen) 方法: cd ~/.ssh && ssh-keygen 其次,把

git clone gi[email&#160;protected]:xxx.git Permission denied (publickey) 问题解决办法

本文主要解决一个问题 git clone 出现公共密钥的权限问题.症状如下: CasondeMacBook-Pro:devops cason$ git clone [email protected]:360yyou/yyou.gitCloning into 'yyou'...Permission denied (publickey).fatal: Could not read from remote repository. Please make sure you have the correc