git checkout downloaded files on Windows 7 - windows

My network from work doesn't let me clone any repository via Windows Git tool by command line git clone therefore I just download the repository.
My problem now is, I need to checkout by git checkout ###### but I cannot figure out how I can do that on my Windows 7. I have installed GitBash tool and Git Desktop, but as I said my network doesn't allow me to do much.

Option 1: local clone
Making a local clone should be your easiest option: it does not involve clone anything from the web so your administrator rules might allow it.
I'll assume you downloaded the remote into workspace/downloaded-bare.git:
cd workspace
git clone downloaded-bare.git sandbox
now you should be ready to work in workspace/sandbox.
Option 2: turn the bare into a working sandbox
If the local clone does not work, you can do the equivalent steps manually:
mkdir sandbox
cp -ar downloaded-bare.git sandbox/.git
cd sandbox
git init
and again, sandbox is now ready for normal work.

Related

Google repo tool (master branch) fails to sync from local mirror on Windows

Recently master branch for Google repo tool has been updated to support Windows OS. It is clear from commit logs : https://gerrit.googlesource.com/git-repo/+log
I am able to run basic commands like repo init and repo sync using repo tool on Windows (which makes use of MinGW Git on Windows). In my work I need to create a local mirror of a repository and then use it. repo tool works fine to create mirror repository.
Here are commands used to create mirror repository on local drive on Windows OS.
$ repo.cmd init -u <URL> -b <branch_name> -m <manifest_file_name> --mirror --no-repo-verify
$ repo.cmd sync --no-tags
--no-repo-verify is used to forcefully use master branch of repo tool.
The above commands create the mirror in local drive C:\git-repo\test\mirror-testing\mirror
But when I refer the above mirror to sync in other drive then it shows error.
Command:
$ repo.cmd init -u <URL> -b <Branch_name> -m <manifest_file_name> --reference="C:\git-repo\test\mirror-testing\mirror" --no-repo-verify
Error:
error: object directory C:/git-repo/test/mirror-testing/mirror/project/manifest.git/objects? does not exist; check .git/objects/info/alternates.
The above command creates alternates file in C:/git-repo/test/mirror-testing/mirror/project/manifest.git/objects/info/ directory and that file contains below path:
C:\git-repo\test\mirror-testing\mirror\project/manifest.git\objects
I have tried other formats to provide reference value:
Git format: "/C/git-repo/test/mirror-testing/mirror"
Cygwin format: "/cygdrive/c/git-repo/test/mirror-testing/mirror"
Using above formats in reference does not create alternates file in objects directory.
repo init time in all above cases simply suggests that mirror is not referred and init is done from network.
When I repeat the same test with Cygwin Git + Google repo tool (stable branch) then I do not see any error and repo init time and sync time is very less compared to the mirror init and sync time, which simply suggests that mirror is referred.
repo.cmd is a batch file wrapper to invoke repo tool with python.
repo.cmd file contains single line
#call python %~dp0\repo %*
I am using Cygwin terminal in Windows 7 to run these commands.
To be clear repo init and repo sync shows error while referring to mirror but it completes successfully by syncing from outside network. The issue is that mirror is not referred.
Has anyone used Google repo on Windows for creating mirror and syncing in other drive using as reference?
I have tested Google repo tool master branch with MinGW Git on Windows 7 and Windows 10.
repo init and repo sync work on both OS.
Even creating the local mirror using --mirror is working, but referring that local mirror to sync in other drive does not work and displays error: "object directory not found".
To be clear using --reference with local mirror shows error, but it eventually uses the network and ignores the local mirror. Ultimately the command completes successfully, but it does not make the use of local mirror. I do not see any workaround for this on Windows for now.
Meanwhile Windows 10 supports Linux bash natively without using any VM.
WSL, the Windows Subsystem for Linux, is a free, optional feature of Windows 10 that allows Linux programs to run on Windows. It provides you with a Windows version of the bash shell and a compatibility layer that permits many Linux programs to run natively on your Windows machine. Using this option you can replace Cygwin Git with Linux Git.
I have tested repo tool on Linux Bash (with Ubuntu distribution installed) for repo init, sync, mirror and reference commands and it works. In fact we use Linux bash so simply Goole repo stable branch works, you do not need to use the master branch to make it work.

Does SSH server need to be running in a unix style environment on remote client for GIT clone to work?

I am tasked to set up a central GIT repo internally for my team.
I'm working on getting this setup on a Windows Server 2012 R2 machine. To the best of my knowledge I've set this up correctly.
I have been following this tutorial but they use CopSSH which isn't free anymore so instead I installed Windows OpenSSH here: Install-Win32-OpenSSH.
On our windows server I've installed and configured the Windows OpenSSH along with GIT. Made the appropriate changes with regards to the environment variables and references needed.
On my local system (also windows) I've installed Putty and generated my public and private keys. The public key has been copied to the server and placed in the correct file. Using putty, I have verified my public/private key authentication is working.
On the server I created a git bare repository in the C: drive like so:
cd C:\
mkdir testing.git
git init --bare testing.git
I installed GIT on my local machine and run the command:
git clone ssh://name#host:port/testing.git
I always end up with the output:
Cloning into 'testing'...
fatal: ''/testing.git'' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I've tried different variations of this command with the same results and moving the testing.git file to the user home directory (C:\Users\name):
git clone ssh://name#host:port/c/testing.git
git clone ssh://name#host:port/~/testing.git
I've messed with permissions to explicitly give permissions for this user to access that directory.
It seems as though, maybe the git clone command cannot find the folder on the remote server. I started thinking that the SSH server itself needed to be running in a unix like environment like cygwin. Is this my issue? I've seen tutorials/walkthroughs of installing cygwin with openssh and this would be my next attempt.
Thanks for any help!
EDIT:
So I went ahead and installed Bitvise with their 30 day trial (to try) and everything works but this is only for 30 days. So this must mean that there is some set up issue with the Windows OpenSSH that I have?

Gitolite on Windows - cloning stuck

I have installed gitolite on windows server using cygwin, installation steps went without problems and when I try to "ssh gitadmin#gitserver info" from local machine(windows) I get the correct response:
hello gitoliteAdmin, this is gitadmin#VRGWLSDEV1T running gitolite3 v3.6.1-6-gdc
8b590 on git 1.9.4.msysgit.0
R W gitolite-admin
R W testing
If I try to clone using Git Bash I get error:
$ git clone gitadmin#gitserver:gitolite-admin
Cloning into 'gitolite-admin'...
git: 'shell' is not a git command. See 'git --help'.
Did you mean this?
help
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
If I try to clone using cygwin terminal on local mashine (using the same ssh key and I get the same valid gitolite message) it returns:
$ git clone gitadmin#gitserver:gitolite-admin.git
Cloning into 'gitolite-admin'...
...and stays like that for enternity!
I have searched for multiple solutions, added PATH (with Git etc.) to .bashrc and .bash_profile files on gitolite designated server. Also added PATH to .gitolite.rc to include custom Git installation path (before that I did not recieve the gitolite message)
If you have any solution or idea what did I do wrong: please....HELP.
Resolved it by myself:
Mysis Git installation was confusing Cygwin. Added Git pack to Cygwin and removed Msys Git env. variables: everything woks perfectly now.

Setting up SVN repository on Remote machine with XCode 4.0

I have followed the documentation to setup the SVN repository for existing project. I followed following steps:
mkdir branches
mkdir tags
mkdir trunk
cp -R /myProject /SVN_Master/trunk
svnadmin create myProject_svn
svn import trunk/myProject file:///SVN_Master/myProejct_svn -m "Initial import"
It has set up SVN repository now. How can I checkout this? It isn't working when I try to checkout from XCode organizer, give path file:///SVN_Master/myProejct_svn. Am I missing something?
How could I setup the same thing for remote host(my server)? Can I just copy created local repository there and use that path?
Thanks.
Got this sorted. It was annoying though as Apple's documentation on this doesn't made any sense. The simple steps you should follow is,
Setup the SVN repository on remote Windows server. I used VisualSVN. I was able to setup in couple of minutes.
From MAC, checkout the code from terminal using "svn co http://serverurl/svn/projectname localdir" command.
Open the project.xcodeproj file and it will try to create repository for you automatically. Make sure that you enter correct user/pass when asked for.

How do I setup git on Windows?

I am very new to the terminologies: git, repository and cloning.
I was able to search them all online and get pretty good grip on each (pretty simple stuff!).
But what I am trying to figure out now is how to "run" these instructions:
Clone repository for app:
git clone git://github.com/SampleLink.git
Update submodules:
git submodule update --init
I am running Windows7. I tried to run init through command prompt, but no luck.
Are these supposed to be run as individual commands or as one following the other in sequence automatically?
I am just not sure how to run these on my Windows machine and cannot seem to get any of it to work.
The submodule is a file within the initial repository.
I'm sorry if this is a lame question, but I have never needed to run this type of setup before.
I would recommend installing msysgit in its "Git for Windows" instance:
Git-1.7.3.1-preview20101002.exe
I like using Option 2, only adding the git\bin directory to the PATH environment variable, but without overriding some built-in windows tools.
From there, git clone over http should work.

Resources