In our project Change-id is mandatory for commits, but I did not found how to add it in Visual Studio Code.
I downloaded the "Gerrit" plug-in, but even so I did not fond a way to add the Change-ID
Any idea?
You need to install the "commit-msg" hook in the ".git" directory of your local repository.
See more details in the Gerrit documentation here.
Basically you need to go (cd) to your local repository and execute the following command:
gitdir=$(git rev-parse --git-dir); curl --create-dirs -Lo ${gitdir}/hooks/commit-msg https://GERRIT-SERVER/tools/hooks/commit-msg; chmod u+x ${gitdir}/hooks/commit-msg
After that, every time you create a new commit or change (--amend) an old one, the Change-Id will be automatically added.
I am working on Robot framework Automation project. All of a sudden git commit does not work I get below error on commit command
**fatal: cannot update the ref 'HEAD': unable to append to '.git/logs/HEAD': Bad file descriptor**
I am working on Windows machine. I have done 4 commits till now and code is in Repo. With the latest changes, commit is not happening with above error I have gone through few issues quoted in stack-overflow regarding this but I could get it resolved.
Please help me in overcoming this issue
I use the command git commit -a -m "description" or git commit -m "description"
None of the sudo command work for me it says
> $ sudo chown -R useremail .git/
> bash: sudo: command not found
It can happen when you accidently create a branch with root permission. Its best to check .git locally for ownership permissions i.e. ls -la .git/refs/heads/ should be owned by the user and not root.
Try the same command with:
a regular CMD session (no Git bash or Cygwin)
the latest Git for Windows 2.21
a new clone repo
You should not experience that bug again.
Git bash is closing automatically in a fraction of second after installation how to fix this?
check whether you've installed git properly, open your command prompt or git bash then type
git --version
C:\Users\07>git --version
git version 2.16.1.windows.1
if you're able to get git version something like this then git is installed in your system. If you're getting any errors or not able to open the command prompt or git bash just check whether you've added git path to your system if not add path and check it once again. Refer this for the installation process and check with the release notes as well.
I'm trying to clone my fork of the kivy git, but it's not working. I've made the fork correctly, I believe, but when I type this into my Mac terminal:
git clone https://github.com/mygitusername/kivy.git
I get this error:
fatal: could not create work tree dir 'kivy.: Permission denied
Anyone see what I am doing wrong? Thanks!
You should do the command in a directory where you have write permission. So:
cd ~/
mkdir code
cd code
git clone https://github.com/kivy/kivy
For example.
Your current directory does not has the write/create permission to create kivy directory, thats why occuring this problem.
Your current directory give 777 rights and try it.
sudo chmod 777 DIR_NAME
cd DIR_NAME
git clone https://github.com/mygitusername/kivy.git
In my case what happened was that the user I was using had no ownership over the directory. I simply had to change ownership of the directory to that user.
For example if user is ubuntu:
chown ubuntu:ubuntu -R directory-in-question
cd directory-in-question/
git clone <git repo comes here >
If you are working in Windows you have to change the permissions of the directory putting full permissions or just write to let github clone the repository. The steps are:
Go To your directory
open properties
go to tab "security"
change the permissions
apply
Assuming that you are using Windows, run the application as Admin.
For that, you have at least two options:
• Open the file location, right click and select "Run as Administrator".
• Using Windows Start menu, search for "Git Bash", and you will find the following:
Then, just press "Run as Administrator".
For other Beginners (like myself) If you are on windows running git as admin also solves the problem.
I had the same error on Debian and all I had to do was:
sudo su
and then run the command again and it worked.
Here is how to change ownership of a directory or a file if you are on WSL2 Ubuntu. You have to set both the user and the group. Here is the command:
sudo chown -R your_username:root path/to/dir
-R is for recursive, which changes the ownership of everything inside path/to/dir. Don't change the group name from root. It should stay your_username:root
The directory in which you are trying to write the file or taking the clone of git repository, it does not has the write permission. That's why this problem is occurring.
Please change the write permission of directory.
Then clone the repository.
If you are working on a mac, then this is probably because you don't have permission to write to the directory.
When I had this issue, I followed the following steps:
Opened the folder in finder -> right-click -> get info -> click on the lock on the bottom right of the pop up window, enter admin password -> then change the Sharing and Permissions to Read and Write for wheel, and everyone -> click lock again to save
This does happened also when you are cloning a repo without selecting any working directory. just make sure you did cd into your working directory and i believe it will work just fine.
You need to ensure you are in a directory in which you have write permission.
This might not be the directory in which Git is in once you open the terminal.
In my case (Widows 10)
I had to use the cd command
to change the directory to the root directory (C:)
After that it worked just fine.
Cloning software into a directory using elevated privileges ie root or sudo is considered a security risk.
You can check to ensure you are in a directory in which you have write permission.(non system) this is probably the directory in which Git is being called from and git is just being decent here by complaining ;-)
Try the following steps for a quick painless solution :-)
1.open the terminal;
2.cd /<desired directory>
3.git clone <git-repo>
This does happened also when you are cloning a repo to your local machine without selecting any working directory. just make sure you did cd into your working directory.
For me it was turning off Realtime Protection on the Virus and Threat Protection on Windows.
All you need to do is Run your terminal as Administrator.
in my case, that's how I solve my problem.
sudo chmod 777 DIR_NAME
cd DIR_NAME
git clone https://github.com/mygitusername/kivy.git
should work fine
I've added remote origin like:
git remote add origin https://github.com/username/repo.git
When I push the git repository, I get this error:
git push -u origin master
fatal: Unable to find remote helper for 'https'
I am on git 1.7.1 on Ubuntu 10.04.4 LTS
Any ideas, greatly appreciated
If you compiled git from source, be sure to install this package first:
apt-get install libcurl4-openssl-dev
I just got the problem yesterday and solved it today, so am posting in case this might help a Windows user. For me, the problem occurred after I updated to the latest version of Git (because Visual Studio was recommending I do so-- something about things not matching.)
It turns out that I installed in the default directory Program Files, but my old Git was in Program Files (x86). (Hadn't noticed until tried reinstalling.)
Uninstalling the new version and installing the 64-bit Git for Windows Setup listed under Other Git for Windows downloads (which is not the default) overlaying the version in Program Files (x86) worked. (I tried other combinations of version and folders first.)
I did have to delete the local repository already created and restart with git init, git add ., git commit -m "first commit", git remote add origin theGitUrl (all of which worked before), before doing the git push origin master. The weird thing is that a pop-up window appeared to enter my user name and password. I didn't notice it at first and thought the processing on the git push was hung up. So, heads up about that "Other Git for Windows" version.
I did change my Environmental Variables before the fix; I don't know if that helped. I added these 2 to the PATH:
C:\Program Files (x86)\Git\bin
C:\Program Files (x86)\Git\libexec\git-core
I did this for both User and System variables.
A note on updating the PATH in Windows 10: you have to add one at a time and not include the ;
After much searching, the answer is you need git version 1.7.7
Can't update RVM - "fatal: Unable to find remote helper for 'http'"
I was working in a chroot jail and thought i had copied everything i needed for git to work but i was missing the git-core files themselves so i just had to copy them:
cp -r /usr/lib/git-core /opt/chroot/myjail/usr/lib/
Add this to git config: (Checked in centos 6.7 and working)
#git config --global url.https://.insteadOf git://
#To see the config added
#git config --list
url.https://.insteadof=git://
user.name=username
user.email=youremail
....