最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【记录】将googlecode上面的crifanLib迁移到Github上

Git crifan 3933浏览 0评论

【背景】

之前把自己的库函数crifanLib放在了googlecode上,一直都很正常。

后来google被封的严重,导致自己访问googlecode都要借助goagent代理。

然后后来有别人提出请求,希望可以把代码放到一个可以方便的,能下载到的地方。

考虑了下,本来打算搬到oschina的代码托管的,无奈:

去注册oschina的代码托管账户,却始终无法收到注册邮件。

也试了多次的重新发送邮件,还是无法收到。

所以放弃。

也想到了SourceForge,因为之前自己的BlogsToWordpress就搬到了那里的。

不过有个缺点:没有github那样可以自动生成最新的代码的可供下载的链接。

所以就想到了github,打算把代码搬到github。

【折腾过程】

1.先去同步最新的,自己的crifanLib的代码,结果遇到问题了:

【未解决】TortoiseSVN中用goagent代理去更新googlecode代码时出错:OPTIONS https://crifanlib.googlecode.com/svn/trunk" not supported by GAE, please enable PHP mode!

截至目前,还是没解决。

2.算了。

还是采用另外一条路吧:

先把本地代码,至少不算很旧的版本的代码,且很可能是最新版本的代码。

上传到github上去就算了。

等以后有机会,再去googlecode上拿到最新代码,如果是更新的,再合并到github上。

3.然后再去参考之前自己的git的经验:

【记录】尝试通过git把BlogsToWordPress的代码上传到SourceForge

【记录】再次尝试用git上传BlogsToWordPress的代码到SourceForge中git仓库

【整理】git add的用法/语法/帮助文件

【整理】git push的用法/语法/帮助文件

不过还得先去github上登录再说。

发现github上面也有教程教如何使用git的:

github tutorial teach how to use git

所以就去参考看看。

Set Up Git – User Documentation

如果不喜欢用命令行,github提供了windows中带界面的工具,可以去这里下载

https://windows.github.com/

不过我目前还是打算好好继续学习git的命令行的使用。

4.算了,貌似上面教程都是基于界面工具来介绍如何设置的,而不是我要的,如何创建仓库。

还是参考:

Create A Repo – User Documentation

去搞懂如何创建一个项目。

github create new repo

github new repository

输入名字后,竟然出现重名的:

“Name already exists on this account”

github new repository Name already exists on this account

难道我之前已经创建过了?我记得好像没有啊。。。

后来去确认了一下,果然是已经创建过了:

github already created repository

empty crifanlib repository on github

。。。

然后继续。

5.然后去编辑那个README.md

不过在编辑期间,想要搞懂这里的语法:

【整理】github上编辑页面中所使用的语法

6.然后再去commit:

edit readme.md then commit

效果是:

after edit readme.md effect on github

然后再去搞懂如何把本地的代码上传上去。

7.搜:

github upload code

参考:

Adding an existing project to GitHub using the command line – User Documentation

不过虽然说是为了避免错误,不让开始就创建README等文件的,但是既然已经创建好了,就继续弄吧。

按照提示操作:

$ git init
Initialized empty Git repository in /cygdrive/e/dev_root/git/crifanLib/.git/

Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib
$ git add .

cygwin git init then add

同时参考:

【记录】尝试通过git把BlogsToWordPress的代码上传到SourceForge | 在路上

去看看status输出结果:

git status for crifanlib local

Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file:   c/crifanLib.c
#       new file:   csharp/crifanLib.cs
#       new file:   csharp/crifanLibAmazon.cs
#       new file:   csharp/crifanLibAws.cs
#       new file:   csharp/crifanLibGoogle.cs
#       new file:   go/crifanLib.go
#       new file:   java/crifanLib.java
#       new file:   java/crifanLibSongtaste.java
#       new file:   php/crifanLib.php
#       new file:   python/crifanLib.py
#

 

果然是新加了一堆文件。

8.然后再去commit:

git commit m para for crifanlib to github

Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib
$ git commit -m 'add local crifanLib to github'
[master (root-commit) 8acf91c] add local crifanLib to github
 Committer: U-NYBDHB7EB3XEHP6\Administrator <Administrator@PC-20131018OHXV.(none)>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

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

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 10 files changed, 12600 insertions(+), 0 deletions(-)
 create mode 100755 c/crifanLib.c
 create mode 100755 csharp/crifanLib.cs
 create mode 100755 csharp/crifanLibAmazon.cs
 create mode 100755 csharp/crifanLibAws.cs
 create mode 100755 csharp/crifanLibGoogle.cs
 create mode 100755 go/crifanLib.go
 create mode 100755 java/crifanLib.java
 create mode 100755 java/crifanLibSongtaste.java
 create mode 100755 php/crifanLib.php
 create mode 100755 python/crifanLib.py

好像用户名和邮箱不是我想要的。

所以按照上面提示去修改:

结果竟然出了问题:

【已解决】cygwin中用git去config配置用户名和邮箱出错:error: cannot run vi: No such file or directory

那就暂时不理会。

不过是后来去解决了上述的git的config的编辑器设置的问题。

接着继续上传:

去页面中:

copy to clipboard from github project page

拷贝项目的git地址:

https://github.com/crifan/crifanLib.git

然后去继续操作:

【已解决】github中git push origin master出错:error: failed to push some refs to

 

【总结】

想要把本地的项目代码,上传到github上面去的话,操作步骤是:

1.去github上面新建一个空的项目。

注意:

最好不要选择那个“Initialize this repository with a README”

否则就会出现我后面遇到的,去上传代码时无法上传,需要先:

git pull –rebase origin master

再去:

git push origin master

才可以正常上传。

2.然后在本地(我此处是在Windows下的cygwin中用git的)去操作:

如此,即可把本地的项目,上传到github上去了。

转载请注明:在路上 » 【记录】将googlecode上面的crifanLib迁移到Github上

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.171 seconds, using 22.18MB memory