I downloaded Git setup and trying to setup for computers in my network. I searched for the process but I found it for to host code on line on github.com. I found a few links but there is not the whole process.
I am aware for how to push and pull.
I downloaded Git setup and trying to setup for computers in my network. I searched for the process but I found it for to host code on line on github.com. I found a few links but there is not the whole process.
I am aware for how to push and pull.
To create a new repository
User following commands to create repository
cd /repo/path/projectname.git
git init --bare
After initialize directory share the directory and grant all permission to local group
To create a local workspace
Create another local repository for local user or other computer use following commands in same order
cd ~/workspace/local/path
git init
git clone user@gitserver:/path/to/your/folder
git add origin repo/path
git add .
git status
git commit
If you're asking about how to connect to a repository hosted by another computer on the same network, take a look at this StackOverflow thread.
Basically, you'll want to use git daemon. If you just need to set up a single repository, that's one line from each machine:
Server:
git daemon --base-path=/path/to/repo --export-all
Client:
git remote add LocalServerName git://<serveraddress>/
or
git clone git://<serveraddress>/
where <serveraddress>
is some reference to that machine (IPv4, IPv6, .local, etc.). You can also specify --verbose for the daemon
command for more detailed output.
I think, also, you could have --base-path
point to a folder with many repositories, and that would let you specify which project you wanted on the client-side like so:
git daemon --base-path=/path/to/all/repos
git remote add ServerName git://<serveraddress>/MyProject/
Be advised: using --export-all will let any computer on the network pull from your repo.
You have to create a repository on the server side. Go to the folder which should be the repository and execute:
git init --bare
Then you have to clone the repository on your client with:
git clone user@gitserver:/path/to/your/folder
Watch this for further information.
.git
extension in [computer 1]mkdir folder.git
cd folder.git
git init --bare
mkdir myApp
cd myApp
git init
git add .
git commit -m "first commit"
git remote add origin [email protected]:/home/alex/folder.git
git push origin master
alex
with the name of your username195.185.1.65
with your IP address from server computergit clone [email protected]:/home/alex/folder.git
folder
, just like if you were doing it from GitHub.git
uses ssh protocol by default for connecting between computers.ssh [email protected]
from remote computer, and it's going to ask you for permission to connect, write yes. I think it's just easier than to copy your public key to the server authorized key file at /home/.ssh/authorized_keys
.alex
with your username, also 195.185.1.65
with your IP address.from source Git--Setting Up the Server
It is just easy as 1, 2, 3, 4:
1) Go to folder, where you want to initialize server(e.g: c:\temp
).
2) Open git bash
in this folder.
3) Type:
git init projectName --bare // e.g => git init test --bare
well,You’ve just set up your server!
4) Choose where you want to initialize client repository and open git bash
there.
Type:
git clone path/projectName // e.g => git clone c:/temp/test
IMPORTANT! DO NOT FORGET TO CHANGE BACKSLASH (
\
) IN THE PATH TO DIRECT SLASH(/
).
You can use this repository as usual and open it with your favorite git client.
connect to this server from another computer in local network:
(in windows 7) Firstly go to Control Panel > Network And Sharing Center > Change advanced sharing settings. Tick turn on network discovery.
Then go to folder where you have set up server and share it with users that you want to give permission for accessing it.
then Type:
git clone //ip/projectName // e.g => git clone //192.168.11.125/test
I hope is useful.
git init projectName
with option --bare
, that --bare
Create a bare repository. If GIT_DIR environment is not set, it is set to the current working directory. the other steps is normally commands. –
Spain git
, ofcourse you can use the offline git server. for example Bonobo Git Server
(for windows os). use this link for download: https://bonobogitserver.com/
. download and create new website in local server and copy the downloaded file to your website and enjoy. –
Spain Basically, you'll want to use git daemon.
For that, make sure to use Git 2.32 (Q2 2021): "git daemon
"(man) has been tightened against systems that take backslash as directory separator.
See commit 9a7f1ce (25 Mar 2021) by René Scharfe (rscharfe
).
(Merged by Junio C Hamano -- gitster
-- in commit bde35a2, 08 Apr 2021)
daemon
: sanitize all directory separatorsSigned-off-by: René Scharfe
Acked-by: Johannes Schindelin
When sanitizing client-supplied strings on Windows, also strip off backslashes, not just slashes.
© 2022 - 2024 — McMap. All rights reserved.
whole process
? Do you need the command to setup a server and clone the repo? – Derbent