Can I change committer author's name in Xcode?
From Xcode in section Adjust Editor Options in Authors I see TarasChernysh and name of commit. So I'd like to use Taras instead of TarasChernysh. Can you help me?
You can change this with following command, if TarasChernysh is your own git user.name:
git config --global user.name "Taras"
The --global will make sure all of your future commits use this given user.name. If you will only in the certain repository, then leave --global out and the user.name changed only for this repository.
I have some projects I would like to upload on my bitbucket private profile. I performed the following steps but I get an error.
Convert my project to git with: git init
Next:
git add
git commit -m "some message"
I created a bitbucket repository and version control system is GIT.
I then type this (of course with real account name and reponame and repo owner):
git remote add origin https://<repo_owner>#bitbucket.org/<accountname>/<reponame>.git
Finally,
git push -u origin master
I did all of this and my terminal gives me this error:
To https://bitbucket.org/milosdev_me/lfs.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://milosdev_me#bitbucket.org/milosdev_me/lfs.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Try:
git push origin master --force
This works for me.
Your master branch has some code that you don't locally have, and to prevent you from conflicts, it doesn't let you to push further changes, before you have them locally. To resolve this, pull all the changes to your local repository (your project):
git pull origin master --allow-unrelated-histories
After that, you will have all the code that is available on your master branch.
NOTE: Be careful, pulling the code from remote branch might mess up all the changes locally. Make sure to save those changes somewhere, or create another branch locally where you will pull your origin master branch, so it doesn't mess up your changes.
Your issue is that you have different things between your local repository and your git repository (probably a readme file that you created automatically), so you have two options:
use git pull origin master, with this command, you will pull from your git repository, but it will cause a merge conflict, which you have to resolve using an IDE (recommended to beginners) or through cmd.
use git push origin master --force, this way, you will force your push from your local repository to your git repository, ignoring any merge conflict by overwriting data. I'm not sure, but I think it will overwrite all git repository data with you local repository data (which is what you want).
Adding --force option is a bad idea
Either rebase it or pull the code, merge it and push it.
git pull --rebase origin master
git push -u origin master
Your remote repository and local repository have differences, something new in remote repository. So for pushing you need pull changes, from remote, previously. Try do:
git pull
git push -u origin master
The issue is because your remote repository and local repository have differences.I had same issue and i tried all the above mentioned solution but nothing worked for me.
For me the scenario was :- I already had my branch in remote repository.If you have the same scenario then follow below steps:-
run command 'git pull'
delete branch from local repository
checkout that particular branch using "checkout as a new local branch" from
the Remote repository.
run command 'git branch -u <your_branch_name>'
run command 'git push or git push --force'
or you can try directly from step 4 first , if it does not work then follow entire steps.Hopefully it will help someone.
If you have your bitbucket account linked to jira.
(this answer will work for you, only if you have your jira account linked to bitbucket)
I was having the same problem trying to push my current branch with the origin.
for example:
my branch name was:
feature/PREFIX-000-new-name-branch.
previous commit:
git commit -m "Write your commit here"
so far it was not working.
you have to mentioned the ticket name in the commit.
if you have made the commit, make an --amend to rename your commit and retry it.
git commit --amend -m "PREFIX-000 Write your commit here"
try the push again.
If you are using BitBucket, this issue occured when I tried to push to a branch but that branch has writing disabled via the repository settings.
if you have already created a project locally and you want to upload it to git,
you will then need to do:
git status to see the changes you need to upload
git add . to add those changes to your repo
git commit -m "" to add a commit message
git push origin master
that way I solved the very same problem I
was having.
it might be a configuration issue
I fixed this issue after updating the global user.email value with my email
git config --global user.email my#email.com
Note: You need to delete the previous commit because it had the wrong email in the commit
i wanted to try GitKraken on Windows 10, but i keep getting this error
Push failed on refs/heads/master: push declined due to email privacy restriction
i do not want to change the privacy settings on GitHub, do you know how to fix this?
As documented at on the GitHub blog, this occurs because you're trying to push commits that contain your real email address and you've configured GitHub to block pushes that do that.
First, run git config --show-origin --get user.email to find out where your email address is set. If you don't see any output, it might be set in the EMAIL environment variable. Change the configuration file or the environment variable to use the masked address that GitHub has provided for you.
Then, use git log --format=fuller to find the commits on your branch that have your real email address in them, and then find the commit before that one. For example, it could be the commit starting with abc1234.
Then, run git rebase -x 'git commit --amend --no-edit --reset-author' abc1234 (substituting the real commit ID in place), and your commits will be rewritten to use the new email address. Do note that this will change all the timestamps on your commits to now, which is not easily avoidable. You will need a fairly recent Git version for this to work.
If you want to change all the commits in this branch, back to the very beginning, use git rebase -x 'git commit --amend --no-edit --reset-author' --root instead.
I have changed the case of some directories in my git repository.
Then I pushed them and noticed the cases where not updated.
Then I found this question:
git mv and only change case of directory
I have followed the advice to use:
git add -A
git commit --amend -m 'updated cases'
git push origin
but instead of success the git server is returning:
To git#github.com:kyogron/example.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#github.com:kyogron/example.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
What can I now do to update the cases without breaking more in my git repo?
Regards,
bodo
PS: To avoid this issue in future you can use:
git config core.ignorecase false
You need:
git push --force
since you have rewritten the last SHA1 with your --amend, after using git mv.
It won't break your repo unless you have other collaborators having already pulled from your previous commit as explained in "How do I push amended commit to the remote git repo?".
(in that case, you would need other options for publishing your fixed commit)
On OsX, this answer does suggest (to avoid this issue):
git config --unset-all core.ignorecase
git config --system core.ignorecase false
The OP kyogron reports having found a working solution:
Create a new branch and checkout this new branch.
Then delete the .DS_Store file in the directory of the corrupted directory and rename it to new name.
Then remove wrong directory in the repository (you can view them with git ls-files) and commit this change.
Again remove the .DS_Store and now rename the directory to the lower case name you want with git mv
I use Git on Windows and set the username and email with:
git config --global user.name "hydRAnger"
git config --global user.email "armyiljfe#gmail.com"
When I use:
git config --global --list
I get the output:
user.name=hydRAnger
user.email=armyiljfe#gmail.com
However, when I use git log the author info should be:
Author: hydRAnger <armyiljfe#gmail.com>
But in fact I get the output:
Author: unknown <hydRAnger#hydRAnger-PC.(none)>
I don't know why the author information incorect.
Setting the user.name and user.email config options does not change already existing commits. It will only work for future commits.
If you also want to rewrite existing commits to use the new user data check out this question:
Change the author and committer name and e-mail of multiple commits in Git
Did you reset the author on your commit after updating your details?
git commit --amend --reset-author
(This will bring up the commit message again - you can just leave it intact)