This question already has answers here:
Git: Please tell me who you are
(3 answers)
Closed 2 years ago.
when I run the git commit -m 'initial' command it shows me the below error
Author identity unknown
Please tell me who you are.
Run
git config --global user.email "you#example.com"
git config --global user.name "Your Name"
to set your account's default identity. Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address
The Git tells you to set your identity before doing git operations. So, complete that by entering the git commands.
git config --global user.email "you#example.com"
git config --global user.name "Your Name"
THese commands are used to set your identity to your git terminal after setting this up. you can able to do the git operations you want
Related
I've been trying to push commits created with a simple shell script:
cd $dir
git add . && git commit -m "Test commit" &&
git push --all origin
The script does the job perfectly. Yet Crontab is stuck at making commits locally and Jenkins is getting 'Permission denied' when accessing a local git folder even if I assign Jenkins a group that owns the folder.
I tried Jenkins jobs with Execute shell either with the code or the path to the script. Any help would much appreciated.
One thing to note is that Jenkins goes back to the original workspace to run each command. So when you run cd $dir, the script will switch to $dir, but once you start the git add... command, it will go back to your workspace directory. To prevent this, either chain the commands together:
cd $dir && git add . && git commit -m "Test commit" && git push --all origin
or use dir to wrap the git commands so that they always run in that specific directory.
As advised by #M B summarizing:
Crontab:
For the cron commits to be pushed automatically:
Add a hook file to your git directory:
How can I automatically push after committing in Git?
Jenkins:
To commit and push automatically add a node. I also added to a sudoers file by sudo visudo:
jenkins ALL=(ALL) NOPASSWD: ALL
%sudo ALL=(ALL:ALL) ALL
I have also assigned a safe directory:
git config --global --add safe.directory /path/to/your/git/dir
EDIT: Just tested with Amazon EC2 Plugin, after cloning the repo on an EC2 instance use:
git remote remove origin
git remote add origin https://ghp_TOKEN#github.com/USER/REPO.git
git add . && git commit -m "COMMIT" && git push --all origin
And these 3 also work for Crontab and Terraform (no other settings needed).
Hope this helps.
I am new to Git. I have recently created a repository and uploaded a folder in it using the following sequence of commands:
$ git init
$ git add <file name>
$ git commit -m "some comment"
$ git branch -M main
$ git remote add origin <url>
$ git push -u origin main
This was my first time when I uploaded the files to this repository. Now I am trying to upload more files to this repository using the following commands:
$ git add <file name>
$ git commit -m "some comment"
$ git branch -M main
$ git push -u origin main
But, I am getting the following information:
Branch 'main' set up to track remote branch 'main' from 'origin'.
Everything up-to-date
Why is it so? How can I upload more files on my repository using git in the command line?
Please resolve it.
Thank you!
I am not sure what is causing you're specific problem here, but i think you are not following the correct workflow. These are the steps you should follow:
Type git branch and ensure that you are on the main branch (if not do git checkout main)
Then do:
git add <file>
git commit -m "comment"
git push -u origin main
Follow this flow everytime you want to push to this branch and you should have no issues.
I have a problem with git submodule update --init --remote.
I receive errors: Permission denied and Failed to clone. But I added SSH keys to my github repository. I can pull, push, git clone.
I have all needed accesses.
I use OS Windows 10.
I changed in .gitmodules file url=git#github.com:xxx to url=https://github.com/xxx , but not helped.
Git will try to clone the submodule using ssh and not https. If you haven't configured your ssh key this will fail. Either change the URL from git#github.com to https://github.com in the .gitmodule file else please follow the steps which might fix the problem.
Delete the folder of the submodule from your local.
Open gitBash and run the following commands.
git submodule sync
git submodule update --init
I'm trying to use Git on Windows by using this command on prompt
git ls-remote --tags --heads git://github.com/jquery/jquery.git
And I'm receiving this error:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I was following this tutorial on Web and I'm wondering what is happening (firewall or anything else).
I'm noob with git so any help will be greatly appreciated.
my corporate firewall has blocked the git protocol.
I change git to use https protocol, so it works.
git config --global url."https://".insteadOf git://
Following the 5.1 instructions to install gitlab
https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md
When I run the command to test the install, I get an error "Git configured for user? ... no"
root#gitlab:/home/git/gitlab# sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...
Git configured for git user? ... no
Try fixing it:
sudo -u git -H git config --global user.name "GitLab"
sudo -u git -H git config --global user.email "gitlab#gitlab.ac"
For more information see:
doc/install/installation.md in section "GitLab"
Please fix the error above and rerun the checks.
Has python2? ... yes
python2 is supported version? ... yes
At no point in the instructions does it say to setup a user.name and user.email for the git user.
Can I safely ignore this warning, or should I deviate from the instructions and set it?
You are right it doesn't. This configuration is needed when you edit something from the web interface. I sent a pull request to include it in installation docs.