使用git管理github上的项目
使用git可以把我们的项目代码上传到github上面去,方便自己管理,如何使用git?觉得是每位程序猿所必需要有的谋生技能,所以在此记录一下自己学会使用的这个过程:
一、需要注册github账号,这样就可以在自己的github上面创建仓库(Create a New Repository)了,填好一些配置信息,然后便可以点击"Create Repository"按钮了!http://t.cn/RUbL4rP如图:

二、安装客户端tortoiseGit(小乌龟),于是我们便可以右键Git Init Here(初始化本地仓库),然后会出现.git文件,同时也可以Git Bash进入git命令行,将项目代码上传至github上面创建的对应的仓库。
三、配置Git
1、首先需要在本地创建ssh key(可以理解创建密钥文件)
进入这个angular项目
$ git init //初始化
$ git add README.md //更新README文件
$ git commit -m 'first commit' //提交更新,并注释信息“one commit”,第一次提交
$ git remote add origin git@github.com:xiaobin5201314/angular.git //第一次需要连接远程github项目
$ git push -u origin master //将本地项目更新到github项目上去,或是(git push origin master)
如果输入$ git remote add origin git@github.com:xiaobin5201314(github帐号名)/gitdemo(项目名).git
提示出错信息:fatal: remote origin already exists.
解决办法如下:
1、先输入$ git remote rm origin
2、再输入$ git remote add origin git@github.com:xiaobin5201314/gitdemo.git 就不会报错了!
3、如果输入$ git remote rm origin 还是报错的话,error: Could not remove config section 'remote.origin'. 我们需要修改gitconfig文件的内容
4、找到你的github的安装路径,我的是C:\Users\ASUS\AppData\Local\GitHub\angular_d14f7551eeb4aea0e4ae9fcd3358bd96420bb5c8\etc
5、找到一个名为gitconfig的文件,打开它把里面的[remote "origin"]那一行删掉就好了!
如果输入$ ssh -T git@github.com
出现错误提示:Permission denied (publickey).因为新生成的key不能加入ssh就会导致连接不上github,可以重新生成一个。
解决办法如下:
1、先输入$ ssh-agent,再输入$ ssh-add ~/.ssh/id_key,这样就可以了。
2、如果还是不行的话,输入ssh-add ~/.ssh/id_key 命令后出现报错Could not open a connection to your authentication agent.解决方法是key用Git Gui的ssh工具生成,这样生成的时候key就直接保存在ssh中了,不需要再ssh-add命令加入了,其它的user,token等配置都用命令行来做。
3、最好检查一下在你复制id_rsa.pub文件的内容时有没有产生多余的空格或空行,有些编辑器会帮你添加这些的。
如果输入$ git push origin master
提示出错信息:error:failed to push som refs to .......
解决办法如下:
1、先输入$ git pull origin master //先把远程服务器github上面的文件拉下来
2、再输入$ git push origin master
3、如果出现报错 fatal: Couldn't find remote ref master或者fatal: 'origin' does not appear to be a git repository以及fatal: Could not read from remote repository.
4、则需要重新输入$ git remote add origingit@github.com:xiaobin5201314/gitdemo.git
使用git管理github上的项目的更多相关文章
- 用Git向gitHub上传项目
用Git向gitHub上传项目 1.安装git 2.在git安装目录下,运行git-bash.exe 如图所示 3.在git中绑定你注册gitHub是的用户名.邮箱. $ git config -- ...
- github git 在GitHub上创建项目并将本地项目push到网站上
众所周知,git是与svn类似的版本控制系统,git的去中心化.分布式等的优点,在不久将来用户量大有可能超过svn, 常见的代码托管网站有GitHub,coding.net, gitee.com 码云 ...
- 使用git克隆github上的项目失败,报错error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
错误描述 今天在github上使用 git clone 某个项目代码的时, git clone https://github.com/XXXX/xxx-blog.git 下载速度很慢,然后下载一段时间 ...
- 二、利用Git将GitHub上的项目拉下项目
本地同样需要安装Git,同样在GitHub上加入ssh公共钥匙 如果忘了 去看上一篇 一.本地项目部署到GitHub上 - 中华田园猫饭饭 - 博客园 (cnblogs.com) 1-鼠标右键点击 G ...
- 使用git管理github上的代码
第一次接触git是使用git来提交自己的github的代码,在new repository之后,github会给出一些操作示例. 示例如下: …or create a new repository o ...
- git clone github上的项目失败 RPC failed
error: RPC failed; curl 18 transfer closed with outstanding read data remainingfatal: the remote end ...
- 手把手教你用git和SourceTree上传项目到github细解(转)
尊重原创:https://blog.csdn.net/qq_32365567/article/details/52859166 一.引言 我想大家现在都很熟悉github了,也能运用github上开源 ...
- IDEA中配置Git,在Github上clone项目到IDEA
一.安装git 1.用homebrew安装git 运行以下命令安装 brew install git 默认的安装位置是 /usr/local/Cellar目录中(后面会用到) 二.在idea中配置Gi ...
- 利用git向github上远程提交一个自己的开源项目
1.在电脑的系统变量中的path路径中配置git的环境变量: 找到git安装路径中bin的位置,如:X:\Git\bin 找到git安装路径中git-core的位置,如:X:\Git\libexec\ ...
随机推荐
- UI-动画
// ------------------UIImageView的动画------------------ // ------------------UIView的动画---------------- ...
- 【linux】grub详解
参数解释 1. default=0 # default后加一个数字n,表示n+1个“title”操作系统,0表示第一个“title” 的操作系统,以此类推. 2. timeout=0 # timeou ...
- SPOJ #440. The Turtle´s Shortest Path
Coding a Dijkstra is not hard. %70 of my time spent on tackling TLE, as my last post. Dijkstra works ...
- PHP析构函数与垃圾回收
析构函数:当某个对象成为垃圾或者当对象被显式销毁时执行. GC (Garbage Collector) 在PHP中,没有任何变量指向这个对象时,这个对象就成为垃圾.PHP会将其在内存中销毁.这是PHP ...
- bzoj4637: 期望
Description 在米国有一所大学,名叫万国歌剧与信息大学(UniversalOperaandInformaticasUniversity).简称UOI大学.UO I大学的建筑与道路分布很有趣, ...
- php缓存数组到文件
php缓存数组到文件 static function getIDs($kemuid) { $cachefile="cache/" . $kemuid . ".cache& ...
- android关于AndroidManifest.xml详细分析
http://my.eoe.cn/1087692/archive/5927.html 一.关于AndroidManifest.xmlAndroidManifest.xml 是每个android程序中必 ...
- Oracle11g空表导出方法
今天凌晨在客户现场进行一个Oracle11g的数据库迁移,习惯性的用了exp/imp,然后在新的数据库发现,空表根本没有exp出来,然后查资料,发现了如下信息:[ORACLE 11G在用EXPORT导 ...
- 204. Count Primes
Description: Count the number of prime numbers less than a non-negative number, n. ============= 找质数 ...
- memcached简介(转)
背景 memcached是一个高性能.分布式的内存对象缓存系统. memcached广泛应用在大负载高并发的网站上,是一种非常成熟的产品(称为一项技术也未尝不可).像facebook,yout ...