Changed Git username and need to commit/push Xcode project - xcode

I am not very familiar with Github.
I changed my username on the web client due to security issues.
I had an Xcode project that I was committing locally and pushing to remote.
I want to push to the same remote but can't since the username is now changed. How do I modify this in Xcode/terminal?
I also want to change the local username to the same one I have on the remote. How/where can I change this

I tried checkout out one of my own GitHub projects (it's public and not that interesting but I'll use it as the example anyway).
When I go to the command line and perform git remote -v I am told:
machine:Clock-Signal user$ git remote -v
origin https://github.com/TomHarte/Clock-Signal.git (fetch)
origin https://github.com/TomHarte/Clock-Signal.git (push)
Supposing I were to change my username to HarteTom then the new remote location of my repository would become:
https://github.com/HarteTom/Clock-Signal.git
Noting that both of those locations are named as 'origin' from the first output I could perform git remote set-url origin https://github.com/HarteTom/Clock-Signal.git. I could confirm that with another git remote -v which would now say:
machine:Clock-Signal user$ git remote -v
origin https://github.com/HarteTom/Clock-Signal.git (fetch)
origin https://github.com/HarteTom/Clock-Signal.git (push)

Related

Where to store GitLab/git credentials stored on Windows 10?

I am trying to figure out where to store my personal access token (PAT) generate in GitLab on a remote Windows 10 environment to authenticate on that GitLab instance.
Assuming I already have a local git repo on a shared drive, I can log in to my environment as myself, authenticate and set my remote like this:
git remote set-url https://{my username}:{my access token}#{repo name}.git
This provides authentication for me and when I commit and push I am properly identified in the gitlab instance.
However, if I log out and a colleague logs in and comes into the same repo on the same shared drive the remote will be authenticated for me rather than them. That is the remote will look like this:
git remote -v
> origin https://{my username}:{my access token}#{repo name}.git (fetch)
> origin https://{my username}:{my access token}#{repo name}.git (push)
This isn't any good because my colleague has to either a) reset the git remote anytime they want to use the remote or b) authenticate with my PAT. Can anyone recommend a way to store ones username and PAT such that the remote looks more like this:
git remote -v
> origin https://{repo name}.git (fetch)
> origin https://{repo name}.git (push)

Remove git from terminal (online solutions not working)(Mac OSX)

I used my old github account and now that is deactivated and i have a new one now. I want it to communicate with my new github username. I've tried many internet solutions and re-installing git and the command line tools. Whenever i type in git remote -v
origin https://github.com/OldUsername/App.git (fetch)
origin https://github.com/OldUsername/App.git (push)
This account is now deactivated so there is no way to use it, I've tried doing the
git config --global user.email "YOUR EMAIL ADDRESS"
git config user.name "Username"
I've been trying for hours and still can't figure out how to get my command line to be able to push to new projects under my new username.
That's the push setting for the remote in your repository config.
Either go hand edit /.git/config or try something like
git remote set-url origin https://github.com/NewUsername/app.git
Remotes are part of a local repository. You can add, remove, rename, or reconfigure them with various git-remote subcommands. You might consider just nuking the current repository directory if it doesn't contain anything you value and cloning or creating a new one.
Alternatively, you can set the URL for a remote using:
git remote set-url origin <new URL>

converting a local git folder as a remote repository

sorry if my question is too naive. Here is what i am trying to do:
I want to create a local git repo (git init )-> i did that
I want to access the same form other machines using ssh -> stuck here
I have tried installing git bash , but i don't know how to configure ssh which is built in the git bash.
I did add a ssh config file using git bash and gave as my computername along with domain, since this machine is the server here.
In the git bash guide, they are adding the public key to github, i dont want that
In short i have created a git repository by 'git init .'
I want to access the same using other machines in the same domain using ssh
I don't know how to proceed further, Would anyone be able to help in this case ?
I'd create a --bare repository somewhere accessible via SSH and push, fetch, merge, pull to and from that repository by adding a remote origin to the ones you created.
Something like
/home/git $ git init --bare your_repository.git
/your/current/repository $ git remote add origin /home/git/your_repository.git
And from another machine
/client/path $ git init
/client/path $ git remote add origin user#server:/home/git/your_repository.git
/client/path $ git pull origin
Then
/your/current/repository $ git fetch origin
/your/current/repository $ git merge origin/master
/your/current/repository $ git push origin master
/client/path $ git fetch origin
/client/path $ git merge origin/master
/client/path $ git push origin master
That's just an example, the --bare repository can be anywhere.
Have a look here for pros and cons http://git-scm.com/book/ch4-1.html

Git connect using ssh on windows

I have read some questions around but still didn't found the solution to this problem
I have git on windows and I want to connect to github using ssh.
Following this tutorial https://help.github.com/articles/generating-ssh-keys
I have successfully setup my keys
If I open a git-bash and try to ssh github I am able to connect, so this works
ssh -T git#github.com
Hi username! You've successfully authenticated, but GitHub does not
provide shell access.
this means that git-bash actually sees my keys. However if I try to do a push
git push origin master
git prompts me for username and password
Thank you for your help
EDIT: solved by using the git protocol instead of the http protocol, my fault
so replace this
https://github.com/_user_/_repository_.git
whit this
git#github.com:_user_/_repository_.git
in the remote link
No need to remove/add, just do something like this:
git remote set-url origin git#github.com:username/repo.git
You probably cloned a remote that uses the https protocol, rather than the git protocol. You need to redefine your remote for origin.
# Change this as needed.
github_username="$LOGNAME"
# Replace your remote, then push.
git remote rm origin
git remote add origin "git#github.com:${github_username}/${PWD##*/}.git"
git push --tags --set-upstream origin master

Can't push branch to github "Use git#github.com:Paratron/spacebattles.git"

I have a working branch in my Mac names database and I would like to push this branch to GitHub and have tried to do this by running:
git push -u origin database
And get the following error message:
You can't push to git://github.com/Paratron/spacebattles.git
Use git#github.com:Paratron/spacebattles.git
Are there known issues that could be the cause for this?
Are there any likely errors I could be doing that results in this error?
Like it says, you can't push to git://github.com/Paratron/spacebattles.git (because it's a read-only URL). Try this:
git remote set-url origin git#github.com:Paratron/spacebattles.git
git push -u origin database
If you haven't ever used git in this way, you need to set it up to work with GitHub first: http://help.github.com/mac-set-up-git/
Also, are you Paratron? If not, you'll need to fork his repository first: http://help.github.com/fork-a-repo/. Then you'll need to use your username instead (git#github.com:YOUR_USERNAME/spacebattles.git).
The URL that you have set for the repository is a readonly URL. You'll need to change the URL for the remote, using remote set-url:
git remote set-url origin git#github.com:Paratron/spacebattles.git

Resources