Reputation: 2677
I can fetch the origin by navigating to the folder and:
git fetch origin
And then execute:
git diff origin/master --name-only
Which shows me the files on the server that are not the same as the local files which is what I am looking for.
But I cannot find the correct syntax to do this via https using a token, I have looked at the help page (https://help.github.com/articles/fetching-a-remote/) and there seems to be nothing there that describes how to do this.
This does not error, but it does not appear fetch the same way as the command above does and executing 'git diff' does not correctly show the files.
git fetch https://[email protected]/myname/repo.git :origin
So how can I use a token to fetch the origin ?
To avoid confusion, the request is succesfull and there is no problem with authentication that works, however the url that I use does NOT enable me to issue the git diff command afterwards and see a list of files that are different on the server.
If I use the first command "git fetch origin" then I am able to see the dirfferences, use the second https command and I cannot see the differences,
git fetch origin
git diff origin/master --name-only
> changed files ARE shown
git fetch https://[email protected]/myname/repo.git :origin
git diff origin/master --name-only
> changed files are NOT shown
Upvotes: 2
Views: 7124
Reputation: 1325137
I want to execute git fetch origin without being prompted for username and p password and use the oauth token instead
First, unless you are using 2FA (Securing your account with two-factor authentication (2FA)), you don't need a token.
A git credential helper would be enough to cache your credentials.
Second, considering the OAuth token section, try with username:token.
(Meaning token as a password)
Upvotes: 2