|
|
Re: how to tell git to use a remote repository [message #753390 is a reply to message #753365] |
Thu, 27 October 2011 00:57 |
julius Messages: 17 Registered: October 2011 |
Junior Member |
|
|
i know that git always has a local copy.
i tried this to get a "fresh" project that uses a remote repository:
remote:
cd /git-repos && mkdir testrepo && cd testrepo
git --bare init
local:
cd localdir
"touch 1 2 3"
git init
git add .
git commit -am 'bla'
git remote add origin ssh://remotehost/git-repos/testrepo
git push origin master
starting with eclipse -> file -> import -> git
since this "empty" repo does not contain a project i did choose "project wizard"
egit recognizes the remote repo, shows the master branch und starts the new project wizard.
their i choose java project and press finish - but now the project is not under version control, i can choose team -> share project....but why?
why does it not use the remote repo (and a local copy of that)?
[Updated on: Thu, 27 October 2011 01:00] Report message to a moderator
|
|
|
|
Re: how to tell git to use a remote repository [message #753457 is a reply to message #753411] |
Thu, 27 October 2011 10:47 |
julius Messages: 17 Registered: October 2011 |
Junior Member |
|
|
Howto share a local project
create a new project in eclipse
"share it" with:
team -> share project -> git -> create...
for name enter mytest
finish -> finish
on the hosting machine do:
git --bare init
to create a empty repo
add something to your java project like a class, in this example i will use 123.
add it to the index, commit it
team -> add, team -> commit
now the description after the project name changes from NO HEAD to master
add this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = ssh://USER@HOST/egittest
[branch "master"]
remote = origin
merge = refs/heads/master
to ~/git/123/.git/config
change the url line
right click on project -> team -> push to upstream
for this to work you only need a empty git repo, its address and a eclipse project.
Howto import a existing java project
lets assume that the project is called lala3
1. create a new project called lala3 on your local machine
2. team -> share project -> git -> create
here you specify where git should store its local files, the default seems to be: ~/git as the parent dir. change that to whatever you want.
for name enter a diretory where the files end up in.i will use somename as example.
finish -> finish
3. add the lines below to ~/git/somename/.git/config
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = ssh://USER@HOST/egittest
[branch "master"]
remote = origin
merge = refs/heads/master
this is the standard git config file with the url where the remote repo resides.
you need to change the value for url.
4. create a temporary java class that is not part of the project to be imported, do team -> add, team -> commit
5. right click on the project -> team -> pull
and the magic happens.
[Updated on: Thu, 27 October 2011 14:22] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04793 seconds