简体   繁体   中英

Configure git to be accessed in my network from portable HDD under Windows

I need to have a portable git setup in order to access a git repository in my LAN from a portable HDD, including the computer where the HDD is connected, under Windows. The HDD might be moved from time to time between the computers in my network. I wish to avoid SSH for the moment.

I have installed the portable version of the git, I have made a batch to set the PATH to the requested directories specified in the documentation before running git-bash or git-cmd.

I see it runs, I have made a bare repository, let's say in a path like m:/repo.git . Then, I got stuck as I don't know how to configure the remote in order to do the first push as `git push repo master' from my project path.

I think I should do a 'git remote add repo ' but I fail to set the correct URL or something. I am aware I should change the URL each time the HDD is moved or change the remote.

What are the correct setup steps?

Then, I got stuck as I don't know how to configure the remote in order to do the first push as `git push repo master' from my project path

Let git create that setting for you:

git clone m:/repo.git
cd repo
git --work-tree=..\myproject add .
git commit -m "first commit"
git push

That will import the files of your project in a local repo, which will be able to push back to your bare repo on M:\\ .

UNC paths are supported too

git.exe clone "d:/dev/SDK" "//comp1/Proj/git/SDK/"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM