在oschian上面建立自己的开源项目livefeng的过程

来源:互联网 发布:mac安装什么杀毒软件 编辑:程序博客网 时间:2024/06/06 18:05
$ ssh -T git@git.oschina.net
Welcome to Git@OSC, Anonymous!


git config --global user.name "freeman"
git config --global user.email "tanyc@126.com"


仓库:repo
在 Git 的概念中,仓库,就是你存在.git目录的那个文件夹内的所有文件,包括隐藏的文件。git init就建立了一个项目的仓库。


本地同步(pull):git pull origin master //origin是远程repo,master是本地repo
提交远程仓库:git push origin master


$ git init
Initialized empty Git repository in E:/work/oschina/livefeng/.git///在livefeng目录下面建立了一个repo,livefeng为空目录。
Administrator@USER-20141115MU MINGW64 /e/work/oschina/livefeng (master)


$ ls ../feng/.
./          ../         .gitignore //这个.gitignore需要特别拷贝过来。 .gitignore 配置文件用于配置不需要加入版本管理的文件,配置好该文件


可以为我们的版本管理带来很大的便利.


Administrator@USER-20141115MU MINGW64 /e/work/oschina/livefeng (master)
$ cp ../feng/* . -r //把项目baseline代码拷贝进来。
cp: cannot create symbolic link ‘./config/config.sub’: No such file or directory
cp: cannot create symbolic link ‘./config/ltmain.sh’: No such file or directory
cp: cannot create symbolic link ‘./config/ylwrap’: No such file or directory
cp: cannot create symbolic link ‘./config/depcomp’: No such file or directory
cp: cannot create symbolic link ‘./config/config.guess’: No such file or directory
cp: cannot create symbolic link ‘./config/install-sh’: No such file or directory
cp: cannot create symbolic link ‘./config/missing’: No such file or directory
cp: cannot create symbolic link ‘./m4/libtool.m4’: No such file or directory
cp: cannot create symbolic link ‘./m4/ltoptions.m4’: No such file or directory
cp: cannot create symbolic link ‘./m4/lt~obsolete.m4’: No such file or directory
cp: cannot create symbolic link ‘./m4/ltsugar.m4’: No such file or directory
cp: cannot create symbolic link ‘./m4/ltversion.m4’: No such file or directory


Administrator@USER-20141115MU MINGW64 /e/work/oschina/livefeng (master)
$ ls config/


Administrator@USER-20141115MU MINGW64 /e/work/oschina/livefeng (master)
$ ls
aclocal.m4   avroot/   config.h     config.status*  contrib/  Doxyfile     feng             feng.sd2.5.xml    m4/          Makefile.in  


RELEASE   tests/
AUTHORS      build.sh  config.h.in  configure*      COPYING   Doxyfile.in  feng.1.xml       git-version-gen*  Makefile     ragel.make   


src/
autogen.sh*  config/   config.log   configure.ac    docs/     etc/         feng.conf.5.xml  INSTALL           Makefile.am  README       


stamp-h1


Administrator@USER-20141115MU MINGW64 /e/work/oschina/livefeng (master)
$ ls m4/
attributes.m4  ax_check_library.m4  ax_prog_bison.m4  ax_prog_flex.m4  ax_tls.m4  lsc_ipv6.m4  lsc_sctp.m4  lscube.m4  ragel.m4  


with_pkg.m4


Administrator@USER-20141115MU MINGW64 /e/work/oschina/livefeng (master)
$ cat ../feng/.gitignore
*.a
*.deps
*.la
*.libs
*.lo
*.o
*.swo
*.swp
*Makefile
*Makefile.in
.cproject
.dirstamp
.project
.tarball-version
.version
ChangeLog
Doxyfile
Doxygen
Makefile.in
aclocal.m4
autom4te.cache
config
config.*
config.h.in
configure
etc/*.conf
feng
feng.1
feng.conf.5
libtool
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
src/cfgparser/cfgparser.h
src/cfgparser/cfgparser.l
src/cfgparser/cfgparser.y
stamp-h1
看出来了,事实就是一些build过程中生成的临时文件和目标文件以及依赖文件,不需要纳入git管理。
问题:这样clone出来的工程可以编译吗??


git add -A,使用-A参数会将添加所有改动的已跟踪文件和未跟踪文件。第一次就得这样做!只是添加索引!


git commit -a -m "init" //-a的意思就是-all changed file. -m是备注的意思。


$ git push //这个意思是远程仓库没有建立起来。
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using


    git remote add <name> <url> //url= https://git.oschina.net/freeman1974/livefeng.git 对吗?我的仓库地址就是这个。


and then push using the remote name


    git push <name>




Administrator@USER-20141115MU MINGW64 /e/work/oschina/livefeng (master)
$ git remote -v //没有显示,说明远程没有repo


Administrator@USER-20141115MU MINGW64 /e/work/oschina/livefeng (master)
$
git remote add origin https://git.oschina.net/freeman1974/livefeng.git


$ git remote -v
origin  https://git.oschina.net/freeman1974/livefeng.git (fetch)
origin  https://git.oschina.net/freeman1974/livefeng.git (push)


$ git push origin master
Username for 'https://git.oschina.net': freeman1974
Password for 'https://freeman1974@git.oschina.net':
To https://git.oschina.net/freeman1974/livefeng.git
 ! [rejected]        master -> master (fetch first)//这个意思是先让我fetch一下再push远程?
error: failed to push some refs to 'https://git.oschina.net/freeman1974/livefeng.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again. //push之前先pull吗?
hint: See the 'Note about fast-forwards' in 'git push --help' for details


Administrator@USER-20141115MU MINGW64 /e/work/oschina/livefeng (master)
$




$ git pull origin master //我就先pull一下吧。拉远程origin到本地master
warning: no common commits
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From https://git.oschina.net/freeman1974/livefeng
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master //自动在origin仓库中建立了一个master branch。为何一定要叫origin呢?应该用项目名!
Merge made by the 'recursive' strategy.
 README.md | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 README.md


Administrator@USER-20141115MU MINGW64 /e/work/oschina/livefeng (master)
$ git push origin master //再拉一次就成功了。
Username for 'https://git.oschina.net': freeman1974
Password for 'https://freeman1974@git.oschina.net':
Counting objects: 152, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (152/152), done.
Writing objects: 100% (152/152), 346.64 KiB | 0 bytes/s, done.
Total 152 (delta 28), reused 0 (delta 0)
To https://git.oschina.net/freeman1974/livefeng.git
   b5a3ca4..95eeacc  master -> master


Administrator@USER-20141115MU MINGW64 /e/work/oschina/livefeng (master)
$


至此,开源项目https://git.oschina.net/freeman1974/livefeng建立成功了!
$ git remote rename origin livefeng //重命名远程仓库。


Administrator@USER-20141115MU MINGW64 /e/work/oschina/livefeng (master)
$ git remote
livefeng


改个名称好一点。这样我有几个项目时,方便区分。

0 0