I have my PC and remote folder on UNC path (lets say *\\10.30.1.15\GitRepositories\MyApp*
).
I have Git installed both in my pc and remote.
What I did is ran git init
on UNC path and at C:/GitRepositories/MyApp
.
Now I add a file at C:/GitRepositories/MyApp
and ran the following commands.
git add .
git commit -m 'initial commit'
git remote add origin \\10.30.1.15\GitRepositories\MyApp
Now when I run git push origin master, I am getting:
C:\GitRepositories\MyApp>git push origin master
fatal: '\10.30.1.15\GitRepositories\MyApp.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.
The UNC path is accessible for all users. Means shared with everyone for now.
Update: After updating the path path by escaping now I am getting,
C:\....>git init
Initialized empty Git repository in C:/..../.git/
C:\....>git remote add origin \\\\10.30.1.15\\GitRepositories\\MyApp
C:\....>git add .
C:\....>git commit -m 'intial'
[master (root-commit) 6870ea2] 'intial'
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 test.txt
C:\....>git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 207 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To \\\\10.30.1.15\\\\GitRepositories\\MyApp
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '\\\\10.30.1.15\\GitRepositories\\MyApp'
How can I avoid those error messages?