How to clear the (Master) sign from git bash? - bash

I have a Windows PC with git installed. Whenever I start git bash, it always stands at /c/Users/_user with the master branch as below: user#DESKTOP-VE8378L MINGW64 ~ (master)
I guess it should look like user#DESKTOP-VE8378L MINGW64 ~
I had a look at people around, found out that they don't have (master) at their first start using git bash. I checked git repo at where I stand with git remote -v but there is nothing.
I tried git status but there is also nothing to help.

maybe you created a git repository in your home directory?
Do you have a .git directory in your home?
If that's the case you should move that repository in a different directory, or delete the .git direcotory if it was created by mistake.

Related

How to deal: not a git repository: '/home/user/git' even if it is

Some time ago i created a 'git' directory in a home path, just to store repos i use. But this somehow broke all my git system and even in ~ folder, when i was trying to use git, i was outputting me this (PWD=/home/user):
$ git status
fatal: This operation must be run in a work tree
I've removed 'git' folder, but appear another problem (PWD=/home/user):
$ git status
fatal: not a git repository: '/home/user/git'
I tried to reinstall git. Not helped. I'm a bit confused about this.
UPD #1:
I'm sorry for bad explanation at the beginning.
This should be clear enough:
$pwd
/home/user/MyGitRepos/some_repo/
$ls -a
. .. .git README.md
$git status
fatal: not a git repository: '/home/user/git'
Any path i am /, /etc, /home/user/ gives me the same output:
fatal: not a git repository: '/home/user/git'
Double-check your environment variables.
If you have GIT_DIR or GIT_WORK_TREE set to /home/user/git, that would explain the error message.
Check also git config -l --show-scope --show-origin in case any configuration would also reference that path.

Git clone on windows : git#github.com is not a git command

I'm trying to clone a repository the ssh way from github and another form gitlab
I'm on windows EDIT : with Git v 2.29.2.2
I'm getting the following error, which I do not understand from what it is coming from :
$ git clone git#github.com:math-gallou/AI21_TPs.git
Cloning into 'AI21_TPs'...
git: 'git#github.com' is not a git command. See 'git --help'.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
So I also tried :
$ git clone "ssh://git#github.com:math-gallou/AI21_TPs.git"
and
$ git clone ssh://git#github.com:math-gallou/AI21_TPs.git
But the same exact error comes out.
When I do the ssh -v git#github.com I can connect with success.
So what did I miss ?
First, if you are trying the ssh:// syntax, then the URL would be:
git clone ssh://git#github.com/math-gallou/AI21_TPs.git
^^^ /, not :
Second, check if you have a %USERPROFILE%\.ssh\config file with a github.com Host entry in it, whose content might be incorrect or mis-interpreted.
In my case, I defined system environment variable GIT_SSH to use openssh I installed, and then git is broken and I got git: 'git#github.com' is not a git command. See 'git --help'..
After deleting system environment variable GIT_SSH everything works again.
Then I tried to define user environment variable GIT_SSH and restart system (I didn't restart system in previous try), somehow now my git works correctly with openssh I installed. I don't know which part is wrong in my previous try but I decide not to waste more time on this.

Why does my git bash always start at master branch?

I have a Windows PC with git installed. Whenever I start git bash, it always stand at /c/Users/_user with master branch as below:
NativeKiwi#nkiwi MINGW64 ~ (master)
I think it should look like this:
NativeKiwi#nkiwi MINGW64 ~
I had a look at people around, found out that they don't have (master) at their first start using git bash. I checked git repo at where I stand with git remote -v but there is nothing.
The string shown in your prompt depends on your PS1 environment variable.
Please check your .bash_profile or .bashrc for the configuration of PS1 environment variable.
I had the same issue (due to running git init) in the wrong directory and fixed it by running rm -rf .git in that directory.
You are seeing master because you created a git repository at the current path using the git init command. Always create git repositories in the folders containing project files. Consider running rm -rf .git command.

git checkout -- <filename> doesn't recover a locally deleted symbolic link on Windows 10

So, yes, I am using Windows 10, when everyone around me at the office is using Linux/Mac. But I won't give up.
I deleted a Symlink which is part of the repo, that was locally created by "git clone" - (Read below why if you are bored)
Now when I run "git status" it says : "Deleted" for my symlinks. I want them back, so I tried the following :
git checkout .
git checkout --
git reset --hard HEAD
Nothing worked, they all completed without errors, but "git status" still shows the symlinks are deleted, and indeed "ls" shows they are gone. Any attempt to create them myself using "ln -s" (in git-bash) results in "typechange" in git status.
How can I get "git checkout ." or any other git command to restore the symlinks to be as they are in the repository?
So, yes, the timestamp should reveal I posted the question when I already knew the answer, but, as I spent almost two hours trying to resolve this, and the answer is not on stackoverflow (yet) I decided I shell post my question anyway and answer it.
Eitam#DESKTOP-JJOOD64 MINGW64 /d/git/my-repo (master)
$ git checkout .
Eitam#DESKTOP-JJOOD64 MINGW64 /d/git/my-repo (master)
The command seems to have completed with no errors or problems, but "git status" will still show my symlinks are not there.
The solution :
run git-bash as Administrator!!! and use "git checkout ." or "git reset --hard HEAD" or any git command that was supposed to work in the first place.
It's quite annoying that git-bash didn't complain that it's missing Administrator privileges. I found out that it's needed when I tried to work around the problem by creating the symlinks myself using "mklink" which told me I need admin priv...

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.

Resources