Sourcetree and github - github

When I push commits to github repo from windows github client, I can see my github username and link to my profile in history, like this:
initial commit [username]
But when I push changes from SourceTree, in commits history it looks like:
initial commit [mac_username]
I want my history on github.com looks like the first example (with github username and link to the profile) What settings I should enable in SourceTree to get it?

Check the config in those repos:
git config user.name
git config user.email
Make sure the repo on Mac has the same settings than the one on Windows.
This thread details how to change those settings in SourceTree, but check if "Allow SourceTree to modify your global Git configuration file" is set: that means it would apply to all your local git repo (Github or not).
The "Full name" is a bit misleading, in that you should use your GitHub login name (and GitHub account email), in order to generate the right commit author history on GitHub.

Go to preferences and on General tab you can see two text fields, one for Full Name and other for email, set the name whatever you want to appear

Related

difference btw local account and github account?

What is the difference between the local account that I set in git bash with git config --global user.name and my actual github account login. I have a test repo, in there I have added a few collaborators. When I push to the repo, the history will show my local name and not my github account username. How come ?
GitHub is not git. GitHub is a remote repository management application. It has its own authentication and account system. You can push git repositories to it so that they can be shared and controlled.
The "local" variables that you set through git config are ways to make it faster to set the author of a commit.
There is nothing stopping you from pushing commits authored by someone who is "not you" to a GitHub remote that you control. I believe they will be associatively "linked" if the emails match, but it's not enforced or required.

How do I view my permissions for a particular Git repo?

I was wondering in GitHub, how do I view the permissions I have to a particular repository? If the URL is
https://github.com/org/repo
Where can I find out what (if any) permission I have?
If the git repo is in github, open any file in the repo, then click 'edit', github will show something like this:
You’re editing a file in a project you don’t have write access to. We’ve created a fork of this project for you to commit your proposed changes to. Submitting a change to this file will write it to a new branch in your fork, so you can send a pull request.enter code here
Refer to this link:
How can I check write access to a remote Git repository ("can I push?")
To check for which of the repositories you have access to (i.e. both forked and non forked)
Click on profile -> Settings -> Repositories
https://github.com/settings/repositories

How can collaborators push their changes to my repo in GitHub

First I have created one project in Eclipse and committed to my GitHub using below commands:git init
git add .
git commit -m "first commit"
git remote add origin URI of my repo
git push -u origin master
Then I modified one file in Eclipse and committed to GitHub from Eclipse through creating remote and giving the remote URI of the repo.
I added my team member through add collaborator.
Then he downloaded my project and made a change in a file in Eclipse.
Now, how can he push that modified file to my GitHub repository from within Eclipse?
We have done one thing. He created a remote and gave the URI of my repo. But still we are unable to commit that file.
You need to add your colleague as a collaborator. This can be done in the desired GitHub repo via Settings > Collaborators (you need to type in your password again). Afterwards they have those permissions.
UPDATE
Sorry and good morning ;)
I overlooked that you already added your partner as a collaborator. Another possible reason for your situation could be in the Temporary interaction limits where you can, amongst others, limit the interaction with your repo to prior contributors.
If that doesn't help. Please add some more informations about your colleague's git logs.
UPDATE 2
#Rahul K regarding your comment (which you better add to your question, for faster recognition), your colleague first needs to integrate the remote changes via git pull origin master in order to be able to push his or her changes afterwards. But be aware that he or she might need to migrate any conflicts to files both of you applied changes to.
Best regards, David
I have resolved the issue by cloning the repo in my local folder, adding the project to eclipse and changing the file committed.
Before that you have to add that person as a collaborator. So that he/she can clone your repo using the command below:
git clone "Path to the repository"
This is an old question but I'll like to say this to help others that might still be facing this same issue.
I also faced this issue with a friend. I already made him a collaborator but he couldn't push. What we did to solve it was to clone the repo using the ssh url instead. Then we set up authentication in git with ssh. And we were able push successfully.
If you already cloned the repo with the usual HTTPS url, you can change the remote origin url using the git remote set-url origin <url> command but url here will be the ssh url.

How to push unsynced commits to GitHub?

I have a GitHub source control tool added to my copy of Visual Studio 2013 and when I right click on the solution and make a commit it says created the commit locally. When I try to sync the commit with the server, the sync button is greyed out.
My question is how do I set it up or what steps do I take so that the commit is pushed to the server?
It looks like you do not have the upstream remote / branch configured for this branch. Visual Studio operates as if the "push.default" configuration is set to "upstream".
If you go to the branches page, this branch should be listed under the "Unpublished" branches section. From that page, you can choose to "publish" this branch by right clicking on the unpublished branch and selecting publish in the resulting context menu. This will push the branch to the origin remote (with a branch of the same name as your local branch) and set the upstream tracking information for this branch. From then on, you can push and fetch from the Unsynced Commits page.
Here is a screen capture of where you need to go to publish an unpublished branch:
You need to add the online GitHub repo as a remote in your local git repo.
On the command line, that's git remote add origin <urL>; I don't know if the VS git UI exposes this.
We use Atlassian Stash but also found the Visual Studio UI a bit confusing at first. The sequence that works for us, using only the UI, is as follows:
First you have to add your "username" and e-mail address in the Git global settings via Team Explorer > Home > Git > Git Settings
On the "Solution Explorer" tab, right click on the solution and "Add Solution to Source Control" and choose Git.
On the "Team Explorer" tab, click on the repo you just created and go to branches
Choose the master branch, right click on it and choose "Publish" - you will be asked for the remote URL whereupon after you enter it, you will get a username/password prompt (for the remote server i.e. GitHub, Stash, etc.)
All this is doing is git push origin masterbut Microsoft chose to make it confusing by giving it another name.
Wait for the "publish" to be completed (there will be a file transfer status shown in the UI)
Once it is completed, go to the commits tab and you will see that all the options for Push/Pull/Fetch etc are available
Note: If you create another branch locally, you will have to push, er "publish", that one as well before the remote knows about it.
Final note: Visual Studio will not create projects and repos for you on the remote. You have to make sure the repo is setup on the remote before you can push a branch to it.
Weird issue: We found that if you try to push to a branch but fail (due to incorrect URL or a permissions issue) that we had to go back to the command prompt to "fix" the remote configuration for the repo/branch. This is using the standard git command:
git remote add origin https://myuser#stash.mycompany.com/scm/myproject/myrepo.git
After you publish a branch as in #jamill's answer you may run into this.
In Team Explorer, I was able to publish a branch, but then I could not do anything. Pull and Push were grayed out as shown:
So I did Actions > Open Command Prompt. Then Type:
git push origin My_Branch_Name
After doing this I could see the branch and my commit in my remote. (Github or whatever in your case). Also when running the command, the output said,
remote: Create pull request for My_Branch_Name:
If you want to keep this branch and merge it into master, then you can create a pull request on your remote. Otherwise as in my case I want to abandon the branch. You don't have to do anything.

Github shows name instead of a linked username in commits

I just helped a friend to set up a Github account to collaborate on my project. His commits come through, but for some reason on the "Source" page of my repository next to his commit is only his name and not his username (with a link).
It seems strange, since Github obviously recognizes him (I added him to the list of collaborators etc.
Seems like a stupid question, but Google couldn't help.
Thanks!
Does your friend have the e-mail address he is using for his commits correctly set up as an alias in GitHub? Otherwise, how is GitHub to know who he is? Git itself only records the full name and the e-mail address and obviously not the GitHub username, since you can use Git perfectly fine without GitHub.
Run this in Terminal:
git config --global user.name "your-github-username"
git config --global user.email "your-github-email"
Add the email used in the git commits to github via Account Settings: Email Settings
Just ask your friend to add email that he use in local git commits to his GitHub account emails list as stated in GitHub Help
you can check the GitHub article:
$ git config --global user.name "example"
$ git config --global user.email "email#example.com"