git clone from bare repository - windows

I created a Visual Studio project using git, later I created a remote bare repository in the path \\xxx.yyy.com\dfs\CORP\Wkg\MoDat\tmp\avl\Repository\WCF\MIlib and added it as origin in Visual Studio, then pushed.
Remote repository seems to be up to date, and from command line a git remote -v in the local folder returns these 2 lines
origin \corp.repower.com\dfs\CORP\Wkg\MoDat\tmp\avl\Repository\WCF\MIlib (fetch)
origin \corp.repower.com\dfs\CORP\Wkg\MoDat\tmp\avl\Repository\WCF\MIlib (push)
I assume I can clone to another local folder from the remote path, so I just copied and pasted exactly the line above to clone it elsewhere
git clone "\\xxx.yyy.com\dfs\CORP\Wkg\MoDat\tmp\avl\Repository\WCF\MIlib" .
Now I get an error
git : Cloning into '.'...
fatal: '\xxx.yyy.com\dfs\CORP\Wkg\MoDat\tmp\avl\Repository\WCF\MIlib' 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 am cloning in the same system in another folder using the same (administrator) user, so it's definitly not relate to access right.
I see in the error that a \ is missing, am I doing something wrong? should the path be somehow escaped?

Are you writing these commands in some kind of bash?
When I was working on Windows I always used forward slashes / instead of backslashes. See if it works for you.

Related

Git Submodule - Unable to Access Repository using Linux Subsystem for Windows

I'm trying to add a Git submodule to a different repository. I created the repository I want it in, but the submodule was created by my advisor.
For convenience, let's say the submodule I'm trying to add is repository A and the one I'm trying to add it to is repository B.
A couple of notes:
I'm using the Linux Subsystem for Windows (i.e., the Ubuntu terminal app).
I have an active internet connection and can access both repositories via the standard git commands (git pull, push, commit, etc.)
I can get all my code working fine using symbolic links to A.
Here are the steps I'm taking to add A to B, and the corresponding terminal outputs.
In: git submodule add git#gitlab.com:Respository_B
The above line worked fine, and I can see the correct info in the .gitmodules file, this is the output:
[submodule "Repository_B"]
path = repository_B
url = git#gitlab.com:Repsitory_B
Now, I tried the following two things:
In: git submodule init
Out: fatal: No url found for submodule path 'submodule_A' in .gitmodules
and,
In: git submodule update --remote
Out: setsockopt IPV6_TCLASS 8: Operation not permitted:
I'm stumped. I tried searching for a solution online, but came up empty-handed. Any ideas on how to fix this?
Also, if I need to clarify anything, please let me know.
Thank you!
EDIT
I just read that there are some chmod issues with the Windows subsystem, so I tried this line and got a different error message.
In: sudo git submodule update --remote
Out: git#gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Unable to fetch in submodule path 'Repository_A'
This is weird, because I am able to access the repository using a symbolic link I made to a local clone.
I'm trying to add is repository A and the one I'm trying to add it to is repository B.
Then the command would be:
cd /path/to/B
git submodule add git#gitlab.com:Respository_A
git commit -m "Add A to B"
git push
Regarding the error message, this issue suggests:
A workaround that we are using is to put the following line in ~/.ssh/config:
AddressFamily inet
Note: Using AddressFamily inet works great if you're connecting to an IPv4 host. If the host is IPv6 only, it won't connect at all.

Git and SSH - How to know what address to use?

I need to set up a git repository in the production server so I can upload all my commits. So, these are the steps I followed:
Production Server (Windows Server 2008)
Installed Git
Created an empty repository at inetpub/wwwroot
Installed CopSSH
Created a new user account
Enabled the user with CopSSH
Changed the default directory of the new user to the repository address
Setted environment variables to read Git commands
Development (Windows 7 + Netbeans)
Installed Git
Created a repository right where my project is
Added all files of the project to the repository
Now, I need to upload my dev project to prod. First, I'm checking if the SSH default directory where I'm pointing to is a repository:
$ git ls-remote ssh://user#server/
fatal: '/' 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 tried adding the folder name, ".git", foldername.git, everything, and I get the same error.
Where am I having the issue? Thank you beforehand.
P.S. I already tested the new default directory and it points right to the empty repository in the server, so it's working.
EDIT: I tried this:
$ git ls-remote user#host:.git
user#host's password:
$_
I got no output. Is that okay?
You're saying the git repository at your server is located at / (say, you should have a /.git directory). As that's probably not true, I'd suggest you to connect via ssh to the server and run pwd (or it's Windows equivalent) to found where your home directory is, and then get the relative path to your repository.
Say, if running pwd right after logging into the server gives you C:\users\my_user and your git repository is at C:\users\my_user\git\my_project, use ssh://user#server:git/my_project as the URL. The : means a relative path from your home directory.
Also you can use an absolute path, as in ssh://user#server/c/users/my_user/git/my_project, or however Windows decides to name your C: partition :)
As you use ssh transport, your syntax tries to access the root of your Copssh installation, Example: if you installed Copssh at c:\copssh, then your root (/) is the same directory.
Your command git ls-remote ssh://user#server/ tries to access that directory.
Try something like
git ls-remote ssh://user#server/home/user* (c:\copssh\home\user) or
git ls-remote ssh://user#server/cygdrive/d/mygit if your repository is at d:\mygit)
If you all want to create a Windows based Git repository, you may consider to stick with Gitwin which has a fully functional free edition. It is Git on Cygwin though and Disclaimer: I'm the developer.

Cannot clone GIT repository on network drive

Using Windows 7, we have a bare GIT repository set up on a network drive so that multiple users can pull/push from it. I am able to create a new working repo on my local and multiple other networked drives. However, when I try to clone a new working repository on the same network drive (different folder) , it fails.
Using TortoiseGIT, after I right-click and choose "GIT Clone", put in all of the necessary paths to my bare repo (the new working repo is already filled in) and hit ok, I get the following error:
Cloning into 'R:\path\to\new\repo'... done.
error: refs/remotes/origin/master does not point to a valid object!
error: Trying to write ref refs/heads/master with nonexistent object 5d2164db2c61efc7a5598f6ff75ed3fbbb12456e
fatal: Cannot update the ref 'HEAD'.
fatal: The remote end hung up unexpectedly git did not exit cleanly (exit code 128)
and it fails to create the repo. It does however build the new folder & ".git" subfolder structure.
It's not a r/w permissions issue because I can r/w any other files, but just cannot seem to create this newly cloned repo. My co-worker cannot either. Even if I got to another folder on the network drive, I still cannot clone the repo successfully. Surprisingly, if I just copy/paste a repo I created in another location, then manually do a "pull", it works and updates successfully.
Any ideas on what to try next? Obviously I've Googled "exit code 128" and "cannot update the ref 'HEAD'" but cannot find a solution to my issue. It's probably something really simple that we are overlooking, but we're just getting started with GIT and this is really causing us headaches...
UPDATE: I just noticed that when I do a manual pull from GIT to my "copy", it is doing a Fast-Forward. Maybe this provides some additional clues?
From R:/path/to/repo
* branch master -> FETCH_HEAD
Updating 5d2164d..d75bdb7
Fast-forward
Files.py | 3 +++
1 file changed, 3 insertions(+)
Success
Git might be trying to do some smart stuff with hardlinks that fails on the network drive. Try using git clone --no-hardlinks /r/path/to/my/repo or git clone file:///r/path/to/my/repo
Please do this via command line in msysgit
git clone /r/path/to/my/repo /r/some/other/path
Further, I would recommend using git from the command line as it is a tool that was designed to be used from the command line. You will be able to find more help, faster, with any issues that come up for you.

Github and Heroku Cloning error - invalid path/syntax error

Here is my problem
I am using heroku to develop an app and I am using github along with it for a project.
Now when I try and use github(clone) without heroku to work on a different project it says...
michael#michael-HP-PavilionNotebook-PC:~$
michael#michael-HP-PavilionNotebook-PC:~$
michael#michael-HP-PavilionNotebook-PC:~$ git init
Initialized empty Git repository in /home/michael/.git/
michael#michael-HP-PavilionNotebook-PC:~$ ls
Desktop Downloads gifiniti Music Pictures Templates Ubuntu One
Documents examples.desktop gifinitiApr24 oldgifiniti Public tmp Videos
michael#michael-HP-PavilionNotebook-PC:~$ git clone git#github.com:toadiferus/SecretTunnel
Cloning into SecretTunnel...
! Invalid path.
! Syntax is: git#heroku.com:<app>.git where <app> is your app's name.
fatal: The remote end hung up unexpectedly
michael#michael-HP-Pavilion-dv6700-Notebook-PC:~$
How would I resolve this error? Can't find any support online for this specific problem.
HOw can I change the syntax of the commands? I want to just clone a project from github not heroku.
THANKS!
Michael
Your ~/.ssh/config may have been hijacked by if you used the heroku accounts plugin. Same thing happened to me. I removed the contents of my ssh config and all is well!
Firstly, you don't need to init before you clone - init is used to turn a project folder into a git repository unless you really intended to turn your entire user directory into a git repo? I would suggest you delete the .git folder that would have been created from your doing this.
To be sure you're using the correct path go to your projects on github and use the icon that looks like a clipboard to copy the correct url to your clipboard, paste onto your command line and see what happens then.
I also don't understand why when you do a
git clone git#github.com:toadiferus/SecretTunnel
Cloning into SecretTunnel...
you get what looks like a Heroku push error??? Git clone from a github URL should simply clone the project from github to your local machine.
! Invalid path.
! Syntax is: git#heroku.com:<app>.git where <app> is your app's name.
Are you editing the output you are pasting?
The git url should have .git on the end, ie. git#github.com:toadiferus/SecretTunnel.git.

How to change the path where Git creates ssh file while "remote add origin ..."?

Good times!
Please, hint me this moment - I use the Windows account with cyrillic account-name. When I try to add my local git repository to github.com, I get the mistake "Could not create directory c/Users/\204\206" ... and I suspect due to my account is cyrillic.
So - how to change this behavior? I want to use Git without changing or renaming account?
Git doesn't create any directories when you add a remote repository. That is, if you type a command like this:
git remote add origin git#github.com:you/yourproject.git
The only thing that happens is that git adds a couple of lines to the .git/config file.

Resources